cBrandon Community

General Category => Linux Fixes => Topic started by: branx86 on September 28, 2015, 09:48:44 AM

Title: AWK Tutorial
Post by: branx86 on September 28, 2015, 09:48:44 AM
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