Grep Files with and without match


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Grep Files with and without match
# 1  
Old 01-15-2016
Grep Files with and without match

Hi There,

How do i finding files with match and without match

Normally,

I will use

Code:
grep -l 'Hello'

grep -L 'Hello World'

How do we combined
# 2  
Old 01-16-2016
Hilarious!

But - I think the requestor wants sth. along this line:
Code:
grep -L "Hello World" $(grep -l 'Hello' *)

This User Gave Thanks to RudiC For This Post:
# 3  
Old 01-16-2016
Code:
grep -l 'Hello' |
xargs grep -L 'Hello World'

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Data match 2 files based on first 2 columns matching only and join if match

Hi, i have 2 files , the data i need to match is in masterfile and i need to pull out column 3 from master if column 1 and 2 match and output entire row to new file I have tried with join and awk and i keep getting blank outputs or same file is there an easier way than what i am... (4 Replies)
Discussion started by: axis88
4 Replies

2. Shell Programming and Scripting

awk to match field between two files and use conditions on match

I am trying to look for $2 of file1 (skipping the header) in $2 of file2 (skipping the header) and if they match and the value in $10 is > 30 and $11 is > 49, then print the line from file1 to a output file. If no match is foung the line is not printed. Both the input and output are tab-delimited.... (3 Replies)
Discussion started by: cmccabe
3 Replies

3. Shell Programming and Scripting

Need help on grep for particular match

Hi, Need help on grep for a particular match. cat testfile xx.xx.xx.xx:/share4 /nfsshare15 nfs defaults yes no xx.xx.xx.xx:/share5 /nfsshare15/sharedir1 nfs defaults 0 0 xx.xx.xx.xx:/share6 /nfsshare15/sharedir2 nfs defaults 0 0 Scenario... (6 Replies)
Discussion started by: sumanthupar
6 Replies

4. Shell Programming and Scripting

New files based off match or no match

Trying to match $2 in original_targets with $2 of new_targets . If the two numbers match exactly then a match.txt file is outputted using the information in the new_targets in the beginning 4 fields $1, $2, $3, $4 and value of $4 in the original_targets . If there is "No Match" then a no... (2 Replies)
Discussion started by: cmccabe
2 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Grep multiple files and display first match

I have a need to grep a large number of files, but only display the first result from each file. I have tried to use grep, but am not limited to it. I can use perl and awk as well. Please help! (9 Replies)
Discussion started by: dbiggied
9 Replies

6. Shell Programming and Scripting

Pattern match using grep between two files

Hello Everyone , I have two files. I want to pick line from file-1 and match with the complete data in file-2 , if there is a match print all the match lines in file 3. Below is the file cat test1.txt vikas vikasjain j ain testt douknow hello@vik@ # 33 ||@@ vcpzxcmvhvdsh... (1 Reply)
Discussion started by: mailvkjain
1 Replies

7. Shell Programming and Scripting

grep - match files containing minimum number of pattern matches

I want to search a bunch of files and list only those containing a minimum number of pattern matches. So if I want to identify files containing 3 (or more) instances of the pattern "said:" and I have file1 that contains the lines: He said: She said: and file2 that contains the lines: He... (3 Replies)
Discussion started by: stumpyuk
3 Replies

8. Shell Programming and Scripting

Need help to grep for a title match and then make some queries after the match

Here is the sample of my file address.txt Address 1 1234 Drive way New Orleans, LA Zipcode :- 12345 Address 2 4567 Spring way Chicago, IL Zipcode :- 67890 I would like to grep for an Address title (Ex :- Address 2) , then get its zipcode and echo both in a single line. Ex :- ... (3 Replies)
Discussion started by: leo.maveriick
3 Replies

9. UNIX for Dummies Questions & Answers

how to use pattern match with grep

hi, i'm having problem like this. i wish to grep some keyword from certain files in one directory. let's say i have a lot of files in my directory with the name of file.1 file.2 file.3 ...... file.500 i only wish to grep the keyword from file.20, file.21, file.23 .... file.50 i tried... (5 Replies)
Discussion started by: rei
5 Replies

10. Shell Programming and Scripting

Grep, count and match two files

I am writing the below script to do a grep and count number of occurances between two tab delimited files. I am trying to achieve.. 1) Extract column 2 and column 3 from the S.txt file. Put it in a temp pattern file 2) Grep and count column 2 in D.txt file 3) Compare the counts between... (19 Replies)
Discussion started by: madhunk
19 Replies
Login or Register to Ask a Question