Guest_imported
New member
- Jan 1, 1970
- 0
I need help with merging two files with matching data. I know very little about writing scripts so please answer at the most granular level if possible. All help will be greatly appreciated.
I am trying to write a script that will take two files (A&B) and extract the needed and matching data to a third file(C).
File A contains detail data with no line numbers.
File B contains the line number of the detail line in file A in the second pipe delimited field that has corresponding information.
The result I am looking for is a file C that contains both file A and file B information on for the matching lines only.
This is what I think I need to do, but I don’t know how to do it.
Have the script receive both file names.
Write a line number to each of the lines in the A file. (Use the wr command maybe?)
Do a grep on the B file, so it contains only the lines that have “Error” in the line.
Use the join command to match the line number that I have added in the A file to the matching line number in the second pipe delimited field of the B file to create a C file that contains the line information that has been combined from both files.
Once again if you could break it down to the lines in the script that would be great. I know very little about writing scripts and using UNIX command.
Thanks for your help.
Kevin
I am trying to write a script that will take two files (A&B) and extract the needed and matching data to a third file(C).
File A contains detail data with no line numbers.
File B contains the line number of the detail line in file A in the second pipe delimited field that has corresponding information.
The result I am looking for is a file C that contains both file A and file B information on for the matching lines only.
This is what I think I need to do, but I don’t know how to do it.
Have the script receive both file names.
Write a line number to each of the lines in the A file. (Use the wr command maybe?)
Do a grep on the B file, so it contains only the lines that have “Error” in the line.
Use the join command to match the line number that I have added in the A file to the matching line number in the second pipe delimited field of the B file to create a C file that contains the line information that has been combined from both files.
Once again if you could break it down to the lines in the script that would be great. I know very little about writing scripts and using UNIX command.
Thanks for your help.
Kevin