1
I have two files in the following format:
File A
4
5
8
9
File B
1 text
2 text1
3 text2
4 text3
5 text4
6 text5
7 text6
8 text7
9 text8
What I want to have for my output is just the following (the second field in File B if it corresponds to the line number in File A):
test3
test4
text7
text8
Pardon my newness, but why are we using 'p' and can you explain what second sed statement is doing? – user3299633 – 2016-06-05T18:33:20.257
p
means "print".-n
means "don't print unless told to".-f-
means "read the script from the standard input". – choroba – 2016-06-05T18:35:46.403How does it know to print? Does it look by default if the first field is same in both files? – user3299633 – 2016-06-05T18:47:24.323
@user3299633: No, a number before
p
stands for the line number. – choroba – 2016-06-05T18:56:04.117