[SOLVED] pipe output san grep search pattern

Alexandros Papadopoulos apapadop at cmu.edu
Thu Sep 11 15:22:42 EEST 2003


On Wednesday 10 September 2003 04:42, Steve Stavropoulos wrote:
> On Wednesday, 10 September 2003, Alexandros Papadopoulos wrote:
> > Έστω πως έχω δυο-τρία pipes του στυλ:
> >
> > grep SCS roster | cut -d , -f 2 | sort | uniq
> >
> > ...που έτσι όπως είναι, μου δίνουν μια λίστα με tokens:
> >
> > Chen
> > Cohen
> > Jagtap
> > Kirigin
> > Tong
> > Wong
> >
> > Το κάθε ένα από αυτά τα tokens υπάρχει μέσα σε ένα άλλο text file
> > (έστω  addresses), με records της γενικής μορφής:
> >
> > token, blah, blah, xx, number, blah
> >
> > Θέλω να δω τη κάθε γραμμή του addresses που έχει κάποιο από τα
> > tokens που μου έδωσε το grep. Πώς μπορώ να "ταΐσω" τα αποτελέσματα
> > του πρώτου  chain από greps σε ένα νέο grep σαν search patterns;
> >
> > Δοκίμασα με xargs αλλά θεωρούσε ότι τα tokens ήταν search targets,
> > και όχι patterns. (οπότε και έφαγα πολλά "file not found")

Protaseis:

1) Xwris na diabaseis to manual tou xargs dineis for i in `your
greps`; do grep $i file; done

2) Diabazontas to manual tou xargs dineis <your greps> | xargs -i
grep {} file

3) grep blah blah > /tmp/lala
grep -f /tmp/lala other_files

4) egrep `grep blah blah | perl -0 -pe 'chop; s/\n/|/g'` other_files

Ayto pou prospa8ousa na kanw einai to (2).

Eyxaristw! :-)

-A
-- 
http://andrew.cmu.edu/~apapadop/pub_key.asc
3DAD 8435 DB52 F17B 640F  D78C 8260 0CC1 0B75 8265
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://lists.hellug.gr/pipermail/linux-greek-users/attachments/20030911/fa6ef612/attachment.pgp>


More information about the Linux-greek-users mailing list