|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
All,
I've seached until I've got a headache and no answers. I've found a couple of close ones but not exactly what I'm looking for. I'm looking for a simple cmd line or script to search a directory tree with all of it's files and I am looking for one word in the files. I've tried gawk, but can't seem to get it to traverse the sub directories. This is a just an example gawk '/hda1/ { print $0 }' /etc/mtab say I don't know the word is in /etc/mtab but I know the word is in etc. How do a search a directory. thx in advance! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
2006-12-5, 11:26(-08), baltoinfo:
> All, > I've seached until I've got a headache and no answers. I've found a > couple of close ones but not exactly what I'm looking for. > > I'm looking for a simple cmd line or script to search a directory tree > with all of it's files and I am looking for one word in the files. > I've tried gawk, but can't seem to get it to traverse the sub > directories. > This is a just an example gawk '/hda1/ { print $0 }' /etc/mtab say I > don't know the word is in /etc/mtab > but I know the word is in etc. How do a search a directory. [...] find /etc -type f -exec gawk /hda1/ {} + With GNU grep: grep -rhDskip hda1 /etc -- Stéphane |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
In article <1165346796.331614.313050@79g2000cws.googlegroups. com>,
baltoinfo <funnsun34@hotmail.com> wrote: >All, >I've seached until I've got a headache and no answers. I've found a >couple of close ones but not exactly what I'm looking for. > >I'm looking for a simple cmd line or script to search a directory tree >with all of it's files and I am looking for one word in the files. >I've tried gawk, but can't seem to get it to traverse the sub >directories. >This is a just an example gawk '/hda1/ { print $0 }' /etc/mtab say I >don't know the word is in /etc/mtab >but I know the word is in etc. How do a search a directory. > >thx in advance! > (cd to the top level of the tree you want to search) find | xargs grep yourstring (with all the usual caveats about how you have to do more than this if you have files with spaces, etc, etc - left as an exercise for the reader) |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
baltoinfo <funnsun34@hotmail.com> wrote:
> All, > I've seached until I've got a headache and no answers. I've found a > couple of close ones but not exactly what I'm looking for. > > I'm looking for a simple cmd line or script to search a directory tree > with all of it's files and I am looking for one word in the files. > I've tried gawk, but can't seem to get it to traverse the sub > directories. > This is a just an example gawk '/hda1/ { print $0 }' /etc/mtab say I > don't know the word is in /etc/mtab > but I know the word is in etc. How do a search a directory. > > thx in advance! man find xargs man grep -- William Park <opengeometry@yahoo.ca>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive http://home.eol.ca/~parkw/thinflash.html BashDiff: Super Bash shell http://freshmeat.net/projects/bashdiff/ |
|
![]() |
| Outils de la discussion | |
|
|