Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filtering

Status
Not open for further replies.

ovince

Programmer
Feb 27, 2007
55
FR
hi

Could someone help me on this?

In each PINK* directory I have 'pink' fajl with some content and I wanna remove all lines containing word 'tau1' or 'tau2' (in all 'pink' fajls in all directories of course)

I wrote this command

find PINK* -type f -name "pink" -exec sed -e '/tau1/d' -e '/tau2/d' > pink1 '{}' \;

Now I have a single 'pink1' fajl with everything inside (at least lines with 'tau1' and 'tau2' are properly removed). But I would like to have 'pink1' for each directory.

how to do this?

thanks
oliver
 
How is your question related to awk ?
Best to post here: forum822
 
it is related to previous post where I do:


find DH* -type f -name "less*data.dat" -exec awk -F, '{if(NR>2 && NR<6){ f=n=FILENAME;sub(/[^/]+$/,"list",f);sub(/.*\//,"",n);print $3,n>>f}}' '{}' \;


Since I do not know how to filter out 'list' in above command, in this step I would like to do it by help of SED

find DH* -type f -name "list" -exec sed -e '/tau1/d' -e '/tau2/d' > list1 '{}' \;

But it does not work as expect. Sorry if I made a big mistake with posting SED question ...


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top