Click to See Complete Forum and Search --> : Grepping


Muzzafarath
12-03-2000, 09:53 AM
How would I go about passing all of the files that have been chmodded to -rw-r--r-- as arguments to a program (ee in this example)? I can grep the files like so (but this includes a lot of other info too):

ls -l --color | grep rw-r--r--

But ee complains if I do this (for obvious reasons http://www.linuxnewbie.org/ubb/wink.gif):

ee `ls -l | grep rw-r--r--`

Any ideas?

[This message has been edited by Muzzafarath (edited 03 December 2000).]

Pierre Lambion
12-03-2000, 10:19 AM
Not sure, but shouldn't you do ls -l | grep bla bla | ee ?

YaRness
12-03-2000, 10:27 AM
you could pipe that "ls...." line into awk.. i don't have my linux box booted up, but... say after that ls line the 4th field returned is the file name, then you could do

ls -l --color | grep rw-r--r-- | awk {print $4} | ee

that would send the list of filenames to ee.

you could shorten that command as well if i remember correctly:

ls -l --color | awk /rw-r--r--/ {print $4} | ee

though i think i have the syntax for awk a bit wrong. anyway, try playing with it.

------------------
"Assembly of Japanese bicycle require great peace of mind."
Registered Linux User #188285 http://counter.li.org/
------------------