I have a simple command like this
grep 'X' results.dat | awk '{print $NF}' > Y.dat
I want to loop this command taking the Xs from column 1 and the corresponding Ys from column 2 of the same file eg. NAMES
NAMES file has the format
C11-C12 p01
C13-C14-C17 P02
etc ..
so the first two steps in the loop should be like this
grep 'C11-C12' results.dat | awk '{print $NF}' > p01.dat
grep 'C13-C14-C17' results.dat | awk '{print $NF}' > p02.dat
awk '$1 ~ /X/{print $1, $2}' results.dat
– Valentin Bajrami Dec 01 '16 at 21:57p01.dat
andp02.dat
files? I give 24 to 1 odds that there is a better way to accomplish your final end result without making these intermediate files. – Wildcard Dec 02 '16 at 01:39