egrep/grep result of more files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting egrep/grep result of more files
# 1  
Old 08-07-2008
egrep/grep result of more files

hi ,

I'm new at unix bash scripting, im playing a little bit with egrep/grep.

I have serveral files and i do a search on those files, like "aki", the result
is many rows outcoming and serveral of them are dubble because aki wil come more than ones in a file, how can i get a result that it will show only
one outcoming per file, i mean i need only to know it aki is in the file yes or no, then only show the files names where the result is true, now it
find in some files over more that 10 times, the result is 10 times the same file. (that's logic..)

Thanks
# 2  
Old 08-07-2008
Use the -l option to only list the names of files which match.
# 3  
Old 08-07-2008
Code:
grep -l "searchstring"  filename

Please see man command for the help text.
# 4  
Old 08-07-2008
Oops i missed that one,

Thanks all!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Homework & Coursework Questions

grep and egrep

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have a text file. 1) How do I search for x and y? 'Find all lines that contain David and Emily' 2) How do I... (1 Reply)
Discussion started by: ninjagod123
1 Replies

3. Shell Programming and Scripting

Using grep or egrep

So a few months ago, I decided to move away from using grep and decided to use egrep in this code that i'm writing. i figured egrep is more robust than grep. well, it appears it isn't. when i used egrep to search the log file for a script that looked like the following, egrep couldn't find... (3 Replies)
Discussion started by: SkySmart
3 Replies

4. UNIX for Dummies Questions & Answers

Difference between grep, egrep & grep -i

Hi All, Please i need to know the difference between grep, egrep & grep -i when used to serach through a file. My platform is SunOS 5.9 & i'm using the korn shell. Regards, - divroro12 - (2 Replies)
Discussion started by: divroro12
2 Replies

5. Shell Programming and Scripting

grep/egrep end of pattern

Hi I use arp to get the mac-addresses of my hosts. # arp -a | grep 192.168.0. e1000g0 192.168.0.1 255.255.255.255 o 00:00:00:00:00:01 e1000g0 192.168.0.11 255.255.255.255 o 00:00:00:00:00:02 e1000g0 192.168.0.2 255.255.255.255 ... (12 Replies)
Discussion started by: domi55
12 Replies

6. UNIX for Dummies Questions & Answers

How to use the "grep/egrep" command to search files.

Hi Team, I am new to this forum and also trying to learn Unix. I will highly appriciate your help if you can help me to get the right command . {{{ I use the command " today | egrep '(10:| 11: )' | grep ERROR " to grep all the files that has been error betweeen 10 to 11... (6 Replies)
Discussion started by: rkhanal
6 Replies

7. Shell Programming and Scripting

using egrep to get result

Hi all, Can egrep using AND OR ?, like egrep -i "title.$1" AND "category.$2" ./home.... I want to give two search criteria, the files where egrep is seaching in for example looks like below rows. title this is an test category space (command line input) $1 script.sh this space ... (6 Replies)
Discussion started by: tvrman
6 Replies

8. Shell Programming and Scripting

how to make menu of result from egrep

hi, im just starting with scripting , i have de following situation im doing a search in a data folder with egrep egrep -i "title.regu." `find . -name "*.dat"` the result is : ./20080816212245/index.dat:title Regular Expressions ./20080811212216/index.dat:title ... (5 Replies)
Discussion started by: tvrman
5 Replies

9. UNIX for Dummies Questions & Answers

egrep counting every 2 lines of result as 1

Hi, Can someone help me count this line: Say I have a file (file1.txt) that contains below: 11/16 13:08:19.5436 18096 --- Generating a <reading> event 11/16 13:08:19.7784 18096 ---- Sending a <writing> event 11/16 13:08:37.4516 18096 --- Generating a <reading> event 11/16... (1 Reply)
Discussion started by: Orbix
1 Replies

10. UNIX for Dummies Questions & Answers

grep/awk/egrep?

Hi, The input file "notifications" contains the following string. FRTP has 149 missing batches I want to search for : FRTP has missing batches As the number 149 is not important and will change. The commands I have tried. grep "FRTP has.*missing batches" notifications.txt... (3 Replies)
Discussion started by: whugo
3 Replies
Login or Register to Ask a Question