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!

Search specific patern

Status
Not open for further replies.

rajy

Programmer
Feb 12, 2004
2
US
Can some body tell me how to get the files in a directory which is "not meeting patterns"

E.g. I have to get all the files which don't have &quot;<source><?source>&quot; and &quot;<target></target>&quot;
 
[tt]ls[/tt] to get a list of files
[tt]grep -v[/tt] to perform an inverted comparison

You should be able to achieve what you want with some form of
[tt]ls | grep -v[/tt]
type command

--
 
Do a grep -c and filter the output for those with a zero count.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
when I am specifing multiple pattern with Grep -c option. It does not produce right results. It's displaying all the files.

grep -c &quot;<source><?source>|<target></target>&quot; *.xml



 
man grep
Pay attention to the -E and -c options.
Try something like this:
grep -Ec &quot;<source><?source>|<target></target>&quot; *.xml |
sed -n 's!:0$!!p'

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top