News:

The Latest electronic and computer Tips that work!

Main Menu

AWK Tutorial

Started by branx86, September 28, 2015, 09:48:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86

Print hey 48 times on screen
yes | head -48 | awk '{print "hey"}'

Print hey.0010 to hey.0099
yes | head -90 | awk '{printf("hey00%2.0f ",NR+9)}'

Head= how many to count
NR= where to start counting from

Print Hello to hello3
yes | head -3 | awk '{printf("hello%.of ", NR+0)}'

Print everyline erasing the 2nd field.
awk '{$2=" ",print}' filename