Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>If what you typed is precisely:</p> <pre><code>sed -e server.txt |sort| &gt; done.txt </code></pre> <p>you should be getting a syntax error from <code>sed</code> complaining that the third 'e' is missing from 'server.txt' (because it will treat that as an attempt at formulating a substitute command with 'e' as the expression delimiter; the <code>-e</code> option means the following argument is a command expression, not a file name).</p> <p>The second pipe should be omitted. As written, you've invoked a null command that creates a file <code>done.txt</code> and then does nothing. If you wanted the output written to the file, you'd need to put a <code>cat</code> or <code>tee</code> command in there. Or, better, omit the second pipe so that <code>sort</code> writes to the file.</p> <blockquote> <p>Can you give an example of how to use <code>cat</code> or <code>tee</code> to make first example work?</p> </blockquote> <pre><code>sed -e s/a/b/g server.txt | sort | cat &gt; done.txt # UUOC award sed -e s/a/b/g server.txt | sort | tee done.txt sed -e s/a/b/g server.txt | sort &gt; done.txt # No UUOC award sed -e s/a/b/g server.txt | sort -o done.txt # No UUOC award </code></pre> <p>I've added an expression for <code>sed</code> so it will read the file <code>server.txt</code>. <a href="http://catb.org/jargon/html/U/UUOC.html" rel="nofollow">UUOC</a> is the 'Useless Use of Cat' award. There's absolutely no need to use <code>cat</code> in the example. Using <code>tee</code> might make sense if you're planning to read all 10 GiB of data as it scrolls past; otherwise, one of the last two options is more sensible; they're essentially equivalent in this context.</p></li> <li><p>Your second command:</p> <pre><code>sed -e server.txt ruby filter.rb &gt; done.txt </code></pre> <p>should be written as:</p> <pre><code>sed -e s/a/b/g server.txt | ruby filter.rb &gt; done.txt </code></pre> <p>I've provided a silly action for the <code>-e</code> option to <code>sed</code>; the output of <code>sed</code> is piped to the <code>ruby</code> script, and the output is then written to <code>done.txt</code>. This is a very standard sort of idiom.</p></li> <li><p>Without more context, I can't tell you what <code>$stdin</code> and <code>$stdout</code> mean. In different languages, it means slightly different things, but typically would be a reference to a variable of some sort. I'm not sure whether any languages treat those two names as special; probably there are some, but neither Perl nor shell has a special meaning for those names.</p></li> </ol>
    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