Wednesday, March 22, 2017

bash: gawk - part I

$ gawk '{print $1}' data1.txt

little
under
besides
own

===============================================

$ gawk -F : -f ./script2.gawk /etc/passwd


$ cat script2.gawk
{print $1 "'s home directory is " $6}

===============================================


$ gawk -F : -f ./script3.gawk /etc/passwd


$ cat script3.gawk
{text="'s home directory is "
print $1 text  $6
}

No comments:

Post a Comment