LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Useless use of cat

[ILUG] Useless use of cat

Niall O Broin niall at magicgoeshere.com
Sun Nov 19 23:14:54 GMT 2000


One regularly sees here situations where some poor punter is flamed fro what
the flamer calls useless use of cat e.g. where someone might have said

cat file|some_program

rather than

some_program < file

However, today I came across a necessary, but apparently useless use of cat.
I had a file with a list of images and some characteristics of those images,
including their format. I wanted to extract all JPEGs and TIFFs so I
naturally tried

niall at bagend:/mnt/images :1>egrep "JPEG|TIFF" imagelist.txt
Binary file imagelist.txt matches

niall at bagend:/mnt/images :2>egrep "JPEG|TIFF" < imagelist.txt
Binary file (standard input) matches

niall at bagend:/mnt/images :3>cat imagelist.txt | egrep "JPEG|TIFF"

.
.
.
lots of output
.
.
.

Now a quick perusal of the grep (egrep being of course just grep wearing
fancy clothes) manual taught me that -a was my friend, but I'm still very
puzzled by the difference between 2 and 3, when in each case egrep surely
sees only that it has a non-TTY as its stdin.


Regards,


Niall




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell