Techiee Techiee - 1 year ago 72
Linux Question

What does awk '/a/ {print $4 "\t" $3} abc.txt mean?

I am learning awk and I was confused with the following command:

awk '/a/ {print $4 "\t" $3}' abc.txt

What does
mean? I was reading the Sed & awk, 2nd Edition by Dale Dougherty. Probably, I didn't reach that part of
text processing part. Hence asked this question.

Answer Source

for every line in the abc.txt file it test if it has a "a" character. If it does prints the fourth word in that line, then a tab character and then the third word.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download