03-03-2009
find file grep it and print file name
i am trying to search a few hundred release note text files for a certain word. however when i use the below command i can find a file that contains it but i dont know the file name. how can i change this command to output the name of the file that grep was successful in?
find builds -name *ReleaseNotes* | xargs cat | grep -i xml
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I tried to simulate some example in Shell particularly finding item and matching in another file.
A very simple example:-
Basically I have 2 files, file A and file B.
In file A, I have columns of fields such that:-
aaa 107
bbb 108
ccc 109
In file B, I have columns of fields... (7 Replies)
Discussion started by: ahjiefreak
7 Replies
2. UNIX for Dummies Questions & Answers
using OS X and the Terminal, I'd like to find all locked files in a specified directory, unlock them, and print a list of those files that were unlocked
how can I do this?
I'm familiar with chflags nouchg for unlocking one file but not familiar with unix enough to do what I'd like.
Thanks! (0 Replies)
Discussion started by: alternapop
0 Replies
3. Shell Programming and Scripting
Hi,
can someone help me.
I have some files and search a content in this files. If i have a hit I will print a output:
filename:content
But are more hits in one file: The output is always filename:content
E.G. Seach about "three"
file1 {one, two, three, four, three}
file2... (5 Replies)
Discussion started by: Timmää
5 Replies
4. Shell Programming and Scripting
Folks
I've been struggling this with for far too liong now and need your help!
I've been happily using grep for a search of a directory, to list the files which contain a string:
find . -type f -mtime -5 -print | xargs grep -l 'invoiceID=\"12345\"'
Now the list of 'invoiceID' I am... (4 Replies)
Discussion started by: daveaasmith
4 Replies
5. Shell Programming and Scripting
Hi all ,
I'm new to unix
I have a checked project , there exists a file called xxx.config .
now my task is to find all the files in the checked out project which references to this xxx.config file.
how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies
6. Shell Programming and Scripting
Hi,
I need helping in finding some of the text in one file and some columns which have same column in file 1
EG
cat file_1
aaaa
bbbb
cccc
dddd
eeee
fffff
gggg
hhhh
cat file_2
aaaa,abcd,effgh,ereref,name,age,sex,...........
bbbb,efdfh,erere,afdafds,name,age,sex.............. (1 Reply)
Discussion started by: jpkumar10
1 Replies
7. UNIX for Dummies Questions & Answers
Solaris 10
When running grep from within find command (don't know the technical term for 'running from within' ) , find command returns only the line which contains the pattern. Is there any way to get the file name printed as well ?
$ pwd
/opt/testdir/anotherDir
$
$
$ cat findme.txt... (3 Replies)
Discussion started by: omega3
3 Replies
8. Shell Programming and Scripting
cat abc.txt
Filename: SHA_AED_Monthly_SNR_20150331.txt.gz
Data Format: ASCII with carriage returns and linefeeds
Compression: GZIP
GZIP Bytes: 36893068
Unzipped Bytes : 613794510
Records: 851310
Record Length: 738
Blocksize: 32472
Filename: SHA_AED_SNR_ChangeLog_20150331.txt.gz
Data... (16 Replies)
Discussion started by: dotran
16 Replies
9. Shell Programming and Scripting
Hello,
I have to fish out some specific columns from a file based on the header value. I have the list of columns I need in a different file. I thought I could read in the list of headers I need,
# file with header names of required columns in required order
headers_file=$2
# read contents... (11 Replies)
Discussion started by: LMHmedchem
11 Replies
10. UNIX for Beginners Questions & Answers
I am having trouble matching *two* strings from one file anywhere in a line of a second file, and could use some help getting this figured out. My preference would be to use grep for this because I would like to take advantage of its -A option. The latter is due to the fact that I would like both... (2 Replies)
Discussion started by: jvoot
2 Replies