IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Shell/awk/grep question
Given a text file, thing.txt, that contains lines of comma-separated data, I want to combine these two steps:

awk -F, '{ print $1 }' thing.txt

and

find . -iname somefilename.txt | xargs grep "pattern"

where pattern is the field printed out by awk.

I can do this in Perl, but I want to throw a couple of executables and a script at this problem, and cannot necessarily install Perl on the boxes that might have to do this.


Peter
[link|http://www.ubuntulinux.org|Ubuntu Linux]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Home]
Use P2P for legitimate purposes!
New This should do it
Except you lose the multi-file happiness of xargs

\nfor file in  `find . -iname somefilename.txt`\n\tdo\n\t\tfor pattern in `awk -F, '{ print $1 }' thing.txt find_file_pat.txt`\n\t\t\tdo\n\t\t\t\tgrep  $pattern $file\n\t\t\tdone\n\tdone\n
New export AWKVAR=`awk -F, '{ print $1 }' thing.txt`
on your way in then grep for $AWKVAR
thanx,
bill
All tribal myths are true, for a given value of "true" Terry Pratchett
[link|http://boxleys.blogspot.com/|http://boxleys.blogspot.com/]

Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free american and do not reflect the opinions of any person or company that I have had professional relations with in the past 48 years. meep
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New Will a NL sepeated list work?
Him, I seem to recall it should.
That always annoyed me that I needed to feed that into grep, but now it makes sense.
     Shell/awk/grep question - (pwhysall) - (3)
         This should do it - (broomberg)
         export AWKVAR=`awk -F, '{ print $1 }' thing.txt` - (boxley) - (1)
             Will a NL sepeated list work? - (broomberg)

Spyingwithdroids on sheep.
69 ms