Recursively finding with AWK Recursively finding with AWK shell shell

Recursively finding with AWK


With GNU awk you would simply do:

$ awk 'NR>1{print $2,$27,$29}' RS='Number of reps:' file19230 1.186 3.98513456 3.186 1.345


Try this:

awk '/Number of reps:/ { printf "%s ", $NF } /calc *201:/ { print $4,$6 }' myfile.dat


This script will do what you want:

$ awk '/nrep=/{printf "%s ",$5}$1=="calc"&&$2=="201:"{print $4, $6}' myfile.dat 19230 1.186 3.98513456 3.186 1.345

It prints the fifth word of the lines containing "nrep=", (with no newline afterwards), and then prints the fourth and sixth words of the lines having the first word "calc" and the second "201:"