On Friday, Oct 5th 2007 at 17:13 -0000, quoth Ben Scott:

=>On 10/5/07, Steven W. Orr <[EMAIL PROTECTED]> wrote:
=>> sort -k 9 <(ls -l /bin) <(ls -l /usr/bin) <(ls -l /usr/X11R6/bin)
=>> # Lists all the files in the 3 main 'bin' directories, and sorts by 
filename.
=>> # Note that three (count 'em) distinct commands are fed to 'sort'.
=>
=>  Hmmm.  Interesting.  Useful, too.
=>
=>  Hmmm!  This effectively lets you concatenate *processes*!  Or
=>rather, their output.  In other words, say I wanted to combine the
=>output of disparate operations into one, so I can sort or grep the
=>common output.  This is common enough with commands which (either
=>through arbitrary limitations or complexity of operation) cannot
=>simply take multiple arguments.  For example, say "foo" can only take
=>one argument:
=>
=>      cat <(foo Fred) <(foo Wilma) <(foo Pebbles) | grep ERROR
=>
=>  Here I'm invoking foo on three Flintstones, but I'm only interested
=>in the output if there is an error message.  (Note that I'm also using
=>cat to concatenate.  Wonder of wonders.)

Yeah, Wonder of Wonders.

grep ERROR <(foo Fred) <(foo Wilma) <(foo Pebbles) 

;-)

=>  Do others here have additional shell tips and tricks?  You know, the
=>kind of thing that you don't see others using much, so you remain
=>unaware of it, then when you discover it, you find it very useful, and
=>keep thinking about how much other people should be using it.  :)

I got a million of 'em ;-)


-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to