in reply to passing pipes on the command line

Note that this use can be dangerous in situations where you are opening a file and the filename comes from an untrusted source (as is typically the case in CGIs, for example).

If you are using bash as your shell, you can do effectively the same thing by using process substitution, even if the file is opened with "<":

join.pl <(sort -t, A.csv |" "grep LALA B.csv | sort -t, )

I suspect other shells (but probably not cmd.exe) may have similar features.

Replies are listed 'Best First'.
Re^2: passing pipes on the command line
by Mugatu (Monk) on Mar 23, 2005 at 17:30 UTC
    That would probably be:
    join.pl <(sort -t, A.csv) <(grep LALA B.csv | sort -t,)
      Oops, you are right. I'm a victim of the cut-and-paste syndrome. :)
      hmm.. nice... so that just passes a FIFO as the filename...

        Exactly. It's a very nice trick when you have a program that expects to read from a file, and has no facilities for reading from STDIN. A common example is diff:

        diff <(grep foo file1 | sort -u) \ <(grep foo file2 | sort -u)

        Of course, we have rapidly veered off topic for the Monastery, so I digress. :-)