looking for files not containing a pattern


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers looking for files not containing a pattern
# 1  
Old 09-12-2008
looking for files not containing a string

Hi All,
I would like to look for all the files in a directory (and subdirectory) NOT containging a given string (the string is "LOST 100 100").

Any idea how to proceed?

Thanks a lot,
Gino

Last edited by f_o_555; 09-12-2008 at 10:20 AM..
# 2  
Old 09-12-2008
Code:
find dir -name "*" -type f -exec grep -lv 'LOST 100 100' {} \;

# 3  
Old 09-12-2008
So if I want to look only for files ending with ".i"
I will use
find . -name "*.i" -type f -exec grep -lv 'LOST 100 100' {} \;

Thanks

Anyway it is listing also the files containing the string, while I would like a list of those files NOT containing the given string
# 4  
Old 09-12-2008
Quote:
Originally Posted by f_o_555
So if I want to look only for files ending with ".i"
I will use
find . -name "*.i" -type f -exec grep -lv 'LOST 100 100' {} \;

Thanks

Anyway it is listing also the files containing the string, while I would like a list of those files NOT containing the given string

It works well for me..Paste the line containing the string in the file which you think will not come as a result of the above command.
# 5  
Old 09-12-2008
Maybe I'm missing something:

I type this
find . -name "*.i" -type f -exec grep -lv 'LOST 100 100' {} \;

I get this
./w55d1.i

tail *.i gives

F28:P,E (102<121<220) (102<121<240) T
E28 0 1199I 15.0 $ 12.5 keV/bin
FT28 scx 1
c ---------------------------------------------------------------------------
CUTSmilie J 1e-2 J J $ cut photons below 10000 eV
CUT:e J 1e-2 J J $ cut electrons below 10000 eV
PRINT 30 40 50 120 128 170 $ print extra table p. 3-136
PRDMP 0 J 1 4 $ print mctal file, only 4 last dumps in r file
LOST 100 100
NPS 125e6

Thank you anyway,
# 6  
Old 09-12-2008
I get this
./w55d1.i

Quote:
tail *.i gives
Why are you giving tail *.i?????

Have you given tail w55d1.i?
# 7  
Old 09-12-2008
Yes, w55d1.i is the only file ending with ".i"
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

2. UNIX for Dummies Questions & Answers

Tar only files with a pattern

Dear All, I have a big tar.gz file with 210 files. About 60 of them have *.control.* pattern and I want only these. Is there a way to extract only the files with this patter? I tried zgrep with tar, but I am not having sucess. Thanks, Leandro (4 Replies)
Discussion started by: lColli
4 Replies

3. Shell Programming and Scripting

Pattern exclusion between two files

I have a large file (file1) that has 96770154 lines and a smaller file (file2) that has 3 lines. I want to remove all of the strings from file1 that occur in file2. file1 looks like this: DOGDOGNODOGTESTCAT CATHELLOBYEEBYEFAT CATCATDOGDOGCATYESGOOD file2 looks like this: YES... (10 Replies)
Discussion started by: verse123
10 Replies

4. Shell Programming and Scripting

Searching across multiple files if pattern is available in all files searched

I have a list of pattern in a file, I want each of these pattern been searched from 4 files. I was wondering this can be done in SED / AWK. say my 4 files to be searched are > cat f1 abc/x(12) 1 abc/x 3 cde 2 zzz 3 fdf 4 > cat f2 fdf 4 cde 3 abc 2... (6 Replies)
Discussion started by: novice_man
6 Replies

5. Shell Programming and Scripting

Find required files by pattern in xml files and the change the pattern on Linux

Hello, I need to find all *.xml files that matched by pattern on Linux. I need to have written the file name on the screen and then change the pattern in the file just was found. For instance. I can start the script with arguments for keyword and for value, i.e script.sh keyword... (1 Reply)
Discussion started by: yart
1 Replies

6. UNIX for Dummies Questions & Answers

Pattern matchin Between Two Files

Hi All, I have two files as below: file1 file2 AAAA CCCC,1234,0909 BBBBB AAAA,1234 AAAA DDDD,23536,9090 CCCC DDDD EEEEE I want a out file as below AAAA,1234 BBBB AAAA,1234... (5 Replies)
Discussion started by: thana
5 Replies

7. UNIX for Dummies Questions & Answers

Listing files containing a pattern!

Hi, Can anyone help me to get all the files having a pattern "Unix". Search will b on the top of a directory.. Suppose two files having path: root -> A -> K -> Z -> File1. root -> A -> K -> X -> File2. We can search from root -> A -> K and File1, File2 should be listed (with complete... (7 Replies)
Discussion started by: susheel567
7 Replies

8. Shell Programming and Scripting

search a pattern and if pattern found insert new pattern at the begining

I am trying to do some thing like this .. In a file , if pattern found insert new pattern at the begining of the line containing the pattern. example: in a file I have this. gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies

9. UNIX for Dummies Questions & Answers

copying a pattern of files in one directory into other with new pattern names...

Hi, I have to copy a set of files abc* in /path/ to /path1/ as abc*_bkp. The list of files appear as follows in /path/: abc1 xyszd abc2 re2345 abcx .. . abcxyz I have to copy them (abc* files only) into /path1/ as: abc1_bkp abc2_bkp abcx_bkp .. . (6 Replies)
Discussion started by: new_learner
6 Replies

10. Shell Programming and Scripting

Pattern searching pattern in c files

I have a problem in searching a specific pattern in c files. My requirement: I have to find all the division operator in all cfiles. The problem is, the multi line comments and single line comments will also have forward slash in it. Even after avoiding these comments also, if both... (6 Replies)
Discussion started by: murthybptl
6 Replies
Login or Register to Ask a Question