Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I put it in this way,The first file contains STRING1 only instead of STRING2. The 2nd file contains STRING2 only . The 3rd file contains some of both (STRING1 and STRING2) so I need the lines from each file that match a line in the 3rd file, I need to print whole line, then I know what to grep and use sed to tailor it.
Okay, I say this way, file3 has lot of lines with a keyword which may be in file1 or file2, if found in file2/file3 print whole line and then I need to append @ to file3 possibly end of the string in file3, ?. File may be in different directory.
What do you mean by do stuff for match?,, there i got issue. could you give me a full script, then I add my logic as I need to do some more stuff, for me that was the question.. how you use regular expression.. 100s of lines will be common , it should automatically search for particular pattern in 3rd file and match with other and print the whole lines of other2.
Here is the correct input of file.
file1:sample1.xml and its content <project name="a/vgi/hard/internal/STRING1/csr" path="software/internal/STRING1/ckr" revision="9zzzzzzdddd667778cc21905857589a"/>
file2:sample2.xml and its content <project name="j/vgi/hard/internal/STRING2/ckr" path="software/internal/STRING1/ckr" revision="xxxxyyy122yyycccmmmmccccccc"/>
The sample2,xml contains all STRING2 projects names instead of STRING1. The sample1.xml contains STRING1 projects.
The 3rd sample.xml contains some of both (STRING1 and STRING2) so I need the lines from each xml that match a line in the 3rd manifest.
For example, one of line in the 3rd manifest is <project path="software/internal/STRING1/csr" name="j/vgi/hard/internal/STRING2/ckr"/> and you may have many such line and it might be in file1 or file2
You would need to match this project to one of the 2 sample.xml:
Script should traverse to each line in 3rd file and if found a match in sample1/sample2 (this is common "j/vgi/hard/internal/STRING2/ckr", in file3 and sample2.xml) it is in sample2.xml and shouldprint the whole line and append in file3.xml,
@Whizje, Does not work, I tried to execute, not doing anything . instead of file1 I put my file1.date, it does not print any match., how to run,? Could you please help me?, It should read 3rd file each line and look for a string if it is file1 or file2 print and append it end of each line.