Help with grep - not showing filenames


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help with grep - not showing filenames
# 1  
Old 02-02-2011
Help with grep - not showing filenames

Hello,

I'm looking for a search string within about 50 files but when the string is found it doesn't tell me in which member it has been found. Any ideas how I can do this?

Cheers

Rob
# 2  
Old 02-02-2011
Can you post the command you have been using please. I'm hoping that you have used the -h flag in it which suppresses the file names. if you have been doing this with a find, then there is a trick to know about, but I will worry about that later on if that is the case.



Robin
Liverpool/Blackburn
Uk
# 3  
Old 02-02-2011
more filenames* | grep string
also tried
grep -n string
grep -l string

Cheer
# 4  
Old 02-02-2011
Just try as below

Code:
grep string filename*

# 5  
Old 02-02-2011
That's great thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

2. Shell Programming and Scripting

Grep showing all files name of the directory

Hi All, Can any one help me here.I'm getting whole files name of the directory along with the grep result. below is the code var=`grep -i '127.3.3.1' _record` echo $var (9 Replies)
Discussion started by: netdbaind
9 Replies

3. Shell Programming and Scripting

Grep and replace multiple strings in a file with multiple filenames in a file

Hi, I have a file containing list of strings like i: Pink Yellow Green and I have file having list of file names in a directory j : a b c d Where j contains of a ,b,c,d are as follows a: Pink (3 Replies)
Discussion started by: madabhg
3 Replies

4. Shell Programming and Scripting

Grep command showing wrong output in Linux

Hi All I am trying to run a script in linux wherein i have a command like this grep ^prmAttunityUser= djpHewr2XFMAttunitySetup_ae1_tmp djpHewr2XFMAttunitySetup_ae1_tmp is a temporary file in which the user value is stored but this command in the script returns me balnk value whereas it has a... (4 Replies)
Discussion started by: vee_789
4 Replies

5. UNIX for Dummies Questions & Answers

Showing Clock

Is it possible to display the clock (timing) on the screen all the time. (3 Replies)
Discussion started by: vino.paal
3 Replies

6. Shell Programming and Scripting

Perl - grep issue in filenames with wildcards

Hi I have 2 directories t1 and t2 with some files in it. I have to see whether the files present in t1 is also there in t2 or not. Currently, both the directories contain the same files as shown below: $ABC.TXT def.txt Now, when I run the below script, it tells def.txt is found,... (5 Replies)
Discussion started by: guruprasadpr
5 Replies

7. AIX

How to grep filenames from a file in other files?

Hi, We have a file called applcust.txt where we keep records of our customizations in the following format. We want to verify whether the file, which is in 3rd column in this file is there in another file called patch999999.log to find out if any of our customization has got overwritten by the... (2 Replies)
Discussion started by: sshah1001
2 Replies

8. UNIX for Dummies Questions & Answers

how to grep filenames and sizes?

How to grep names and sizes of files in a directory by month and output to a file? ex: file1 | size1 file2 | size2 ... ... so on (2 Replies)
Discussion started by: helen008
2 Replies

9. Shell Programming and Scripting

grep and awk showing filename in loop

I am attempting to grep a list of files for a string an and then only extract the 3rd and 4th field of from the line. That's easy. But I want to prefix the line with the filename that the information came from. for filename in `ls -1 *.txt' do grep search_text $filename | awk '{print $3"... (5 Replies)
Discussion started by: sjohns6
5 Replies

10. Shell Programming and Scripting

how to grep all the filenames in a script

hello, we have a script (let say ABC) which contains the below: lp -d lp06 -t 'REPORT FOR FINANCE -FIN-' $daily/FINRPT lp -d lp06 -t 'REPORT FOR FINANCE -FIN1-' $daily/FINRPT1 lp -d lp06 -t 'REPORT FOR HUMAN RESOURCE -HR-' $dd_daily/HRRPT lp -d lp06 -t 'REPORT FOR MANAGEMENT -MGM-'... (10 Replies)
Discussion started by: newbie168
10 Replies
Login or Register to Ask a Question