Not with the sample data that you gave in post#7 (which, btw, is entirely different from the ones you showed in post#1). Why, btw, do your desired outputs differ from post#7 to #9?
My file 2 will be something like this
Desired output is
Basically I want to compare filename in file 2 if it matches filename in file1 print id mentioned against matching file from file2 is dependent on id in file 1 for the matching file ,outputiing it to file 3.
---------- Post updated at 04:35 AM ---------- Previous update was at 04:19 AM ----------
Kindly help me as it an urgent requirement also can u please explain me the logic of what you wrote above that will help me understand what is exactly being done
Moderator's Comments:
Last chance: use CODE tags as required by forum rules! With your next infraction you'll be placed on (temporary) read only.
Last edited by RudiC; 07-15-2018 at 07:03 AM..
Reason: Added CODE tags.
By just looking at your new files, it can be seen that your desired output is impossible to achieve. b.txt is not in file2 so no match will be found for it. No need to do a test run.
Ok My bad again. Again I missed typing b.txt in my file 2. Please accept my apologies
My file 1 contents will be something like this
My file2 contents will be something like this
Desired output is
This time I have cross verified what I am asking. This is the right format now.
Basically in simple terms I want to compare if same file name is present in both file 1 and file 2 , then output the assoiciated ids in the format of the output shown.
Kindly help me as it is urgent requirement
---------- Post updated at 08:09 AM ---------- Previous update was at 08:06 AM ----------
Ok My bad again. Again I missed typing b.txt in my file 2. Please accept my apologies
My file 1 contents will be something like this
My file 2 contents will be something like this
Desired output is
This time I have cross verified what I am asking. This is the right format now.
Basically in simple terms I want to compare if same file name is present in both file 1 and file 2 , then output the assoiciated ids in the format of the output shown.
Kindly help me as it is urgent requirement
Moderator's Comments:
As requested many times before, please use CODE tags when displaying sample input, sample output, and code segments.
You can look at the tutorial in the infraction message you received associated with this post to see how to use CODE tags or you can use the editor to look at how CODE and ICODE tags have been inserted into this message to see how they can be inserted manually.
Please help me out: In four posts you've been asked to stick to forum rules and use code tags, PLUS you received four infractions including verbose reminders to do so. Don't you believe us when we say you'll be set on read only the next time, and you refuse to comply to the forum rules? What should we do now?
Like to have shell script to Read the given file contents into a merged one file with header of path+file name followed by file contents into a single output file.
While reading and merging the file contents into a single file, Like to keep the format of the source file.
... (4 Replies)
I am trying to consolidate multiple information files (<hostname>.Linux.nfslist) into one file so that I can import it into Excel. I can get the file contents with cat *Linux.nfslist >> nfslist.txt. I need each line prefaced with the hostname. I am unsure how to do this.
--- Post updated at... (5 Replies)
So I'm stumped.
First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes.
I have a text file (file_source) of terms, each line... (3 Replies)
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Hi All,
Need help on this
I have 2 files
one file file1 which has several entries as :
define service{
hostgroup_name !host1,!host5,!host6,.*
service_description check_nrpe
}
define service{
hostgroup_name !host2,!host4,!host6,.*
service_description check_opt
}
another... (2 Replies)
All,
PLease can you help me with a shell script which can compare two xml files and print the difference to a output file.
I have attached one such file for you reference.
<Group>
<Member ID=":Year_Quad:41501" childCount="4" fullPath="PEPSICO Year-Quad-Wk : FOLDER.52 Weeks Ending Dec... (2 Replies)
Hello
Has anyone got an example shell script that I can use to compare the contents of two files.
The files should contain the same contents, eg.
file1.txt
apple
pear
grape
file2.txt
apple
pear
grape (2 Replies)
Give shell script....which takes two file names as input and compares the contents, is both are same delete second file's contents.....
I try with "diff"...... but confusion how to use "diff" with if ---else
Thanking you (5 Replies)
Hi guys,
firstly I'm working on SunOS 5.10 Generic_125100-10 sun4u sparc SUNW,Sun-Fire-V240
I've made a script to compress two directory and then send them to an other server via ftp. This is working very well.
Inside theis script I decide to log usefull data for troubleshooting in case of... (7 Replies)
hello
have a file1
H87I
Y788O
T347U
J23U
and
file2 J23U U887Y I99U T556U
file3 I99O J99T F557J
file4 N99I T666U R55Y
file5 H87I T347U
file6 H77U R556Y E44T
file7 Y788O K98U H8I
May be using script we can use file1 to search for all the files
and have the output
H87I file5... (3 Replies)