Concatenate column 1 and column 2 of related lines
Hi everyone,
I have a file containing many lines, some of them begin with 74521 in column 1, others have the word "ATRB" in column 5, an the rest other info that doesnt care to me. I´ve filtered only lines containing what I´ve explained above using Code:
awk '/74521/||/ATRB/' source.txt > output.txt Code:
74521019143 515097017017121 COMPLETE AVAILABLE is part of that line. 2 consecutive lines that begin with "75421", may dont have lines containing the word "ATRB" between them, in this case that lines are not interesting either. Based on this info and the filtered file I´ve got at the moment I´like to obtain a last arrangement using colum 1 & column 2 of lines that begin with 74521 and the correspondent column 1 & column 2 of lines that contain "ATRB". This four columns in the same line as follow Code:
74521956785 515097011027927 2 1 3 1 5 3 Many thanks in advance |
Use an associate array to store all values related to a particular key. Then print out the array.
|
Use nawk or /usr/xpg4/bin/awk on Solaris:
Code:
awk 'END { |
Hey radoulov,
It works very nice, really thanks for your help. Now, I only trying to include analysis of some other cases that could happen, I hope be succesful in that thask, but with the code you´ve gave me it´s almost 99% of what I needed. Thanks again. |
would a combination of grep , cut and paste work ?
|
All times are GMT -5. The time now is 01:00 AM. |