Saturday, April 26, 2014

awk


awk command examples


 Remove duplicate lines using awk

$ awk '!($0 in array) { array[$0]; print }' temp

Print all lines from /etc/passwd that has the same uid and gid

$ awk -F ':' '$3==$4' passwd.txt

Print only specific field from a file.

$ awk '{print $2,$5;}' employee.txt



0 comments:

Post a Comment