Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="https://stackoverflow.com/a/14483620/15168">answer</a> by <a href="https://stackoverflow.com/users/967492/potong">potong</a> is almost correct; it only handles one server, rather than multiple servers, but the change required is small.</p> <pre><code>$ sed -e '/^[^ ]*$/{h;d;}' -e 'G; s/\(.*\)\n\(.*\)/\2 \1/' data qa-ops01.mysite.com /dev/mapper/sys-home 58G 26G 30G 47% /home qa-ops01.mysite.com /dev/mapper/sys-tmp 3.9G 2.3G 1.5G 61% /tmp qa-ops02.mysite.com /dev/mapper/sys-home 58G 26G 30G 47% /usr qa-ops02.mysite.com /dev/mapper/sys-tmp 3.9G 2.3G 1.5G 61% /var qa-ops03.mysite.com /dev/mapper/sys-home 58G 26G 30G 47% /lib qa-ops03.mysite.com /dev/mapper/sys-tmp 3.9G 2.3G 1.5G 61% /etc $ </code></pre> <p>The script is in two parts, identified by the two <code>-e</code> options. The first part identifies server names; those lines contain no spaces (hence <code>/^[^ ]*$/</code> looks for a line with no spaces), and copies the line into the hold space (<code>h</code>) and then deletes it (<code>d</code>) and continues with the next line. The second part of the script is only exercised on lines that contain spaces. It appends the content of the hold space to the pattern space after a newline (<code>G</code>); then it splits the line into 'everything up to the newline' and 'everything after the newline', and switches them so that the 'after' (<code>\2</code>) comes first, then a space, then the 'before' (<code>\1</code>).</p> <p>This uses the classic <code>sed</code> regular expressions; it was tested on Mac OS X (10.7.5) with both the BSD <code>sed</code> and also with GNU <code>sed</code> without change. GNU <code>sed</code> has options such as <code>-r</code> to change the interpretation of regexes which would save you a few backslashes.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload