12-08-2010
Now i am getting the line which has the required pattern.
Whenever the pattern is matched, it should display the content from other file.
Eg:
I have three files say xxx.txt, yyy.txt, and zzz.txt
xxx.txt with list of patterns within double quotes. Eg.
"this is the line1"
"this is the line2"
The yyy.txt with lot of lines. eg:
"This is a test message which contains rubbish information just to fill the page which is of no use.
this is the line1 which is suppose to be grepped and displayed as a output."
zzz.txt with the following lines. eg:
"line one found"
"line two found"
My requirement is to search the pattern given in xxx.txt at yyy.txt and if it exists in yyy.txt then display the corresponding line from zzz.txt.
Eg output: line one found
Can you please let me know the solution?
Last edited by abinash; 01-15-2011 at 01:44 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
dear ones
pl.kindly help me 1) how to print(grep) required pattern and following 2 or 3 lines. 2) grep required pattern(to print)+above 2 lines+below 2 or 3 lines.from a report file.
ex:
we have some report file
kf askfjsk fksaj fk skf sjfksjd kff sjfkjs kf jskdjfklsd jfklsdf sdkfjsd fsd... (3 Replies)
Discussion started by: cvvsnm
3 Replies
2. Shell Programming and Scripting
Hello friends,
I am writing a simple shell script which will copy one particular type of files to backup folder if files exists. If files doesn't exists, mv command should not be executed.
My file pattern is like wcm-spider-maestro.log.2009-07-15, wcm-spider-maestro.log.2009-07-16 etc..
I... (6 Replies)
Discussion started by: sreenu.shell
6 Replies
3. Shell Programming and Scripting
Hi,
When we have a failure, sometimes we just step restart the job from the next step. Later when we open the log for analysis of the failure, it is becoming difficult to go to the failure part.
For eg., if it is a 1000 line log, the failure may be at 500th line. so wat i want to do is, grep... (6 Replies)
Discussion started by: ajayakunuri
6 Replies
4. Shell Programming and Scripting
*****************************************
Right now i have this current system.
I have two files say xxx.txt and yyy.txt. xxx.txt is with list of patterns within double quotes. Eg.
"this is the line1"
"this is the line2"
The yyy.txt with lot of lines. eg:
"This is a test message which... (7 Replies)
Discussion started by: abinash
7 Replies
5. UNIX for Dummies Questions & Answers
So, I know how to do some of this stuff on an individual level, but I'm drawing a blank as to how to put it all together.
I have a pattern that I'm looking for in a log file. The log file I know came in yesterday, so I want to limit the search to that day's listing of files. How would I do... (5 Replies)
Discussion started by: kontrol
5 Replies
6. Shell Programming and Scripting
Hi ! All
I just want to search and write to new file if pattern is found in text file
following are my text files by which I want to search Month and last column number
my text file1
15-Jan-2011 25 ARTS 1255 125 125 178 198
15-Jan-2011 25 ARTS 1255 125 125 178 198
15-Jan-2011 25... (3 Replies)
Discussion started by: nex_asp
3 Replies
7. Shell Programming and Scripting
Hi All,
Would like to ask on how to refrain the message file not exists from display out.
if ; then
When it execute, the OS will throw the error file does not exists
ls: 0653-341 The file COL_*/*.CTL does not exist.
Thanks. (3 Replies)
Discussion started by: ckwan
3 Replies
8. UNIX for Dummies Questions & Answers
I have many files that can have various amounts of rows. I essentially want to output each row into a new file if a pattern is matched between two files.
I have some code that does something similar but I want it to output every single input row from every file into a separate output file; that... (5 Replies)
Discussion started by: verse123
5 Replies
9. Shell Programming and Scripting
Hi experts,
I have two arrays one has the file paths to be searched in , and the other has the files to be serached.For eg
searchfile.dat will have
abc303
xyz123
i have to search for files that could be abc303*.dat or for that matter any extension . abc303*.dat.gz
The following code... (2 Replies)
Discussion started by: 100bees
2 Replies
10. UNIX for Beginners Questions & Answers
he below looks in $dir for any pattern of fileone. As is, it executes but only returns File found if the exact format in the script exsists. Why isn't a pattern of fileone being looked for and if it is in $dir, File found. I think that is what should happen. Thank you :).
dir=/path/to
if... (5 Replies)
Discussion started by: cmccabe
5 Replies