Here are some of the useful awk program collections!awk '{print $2,$1}' filename
awk '{print $2,$1}' filename
awk '$1 > $2 {print $1,$2,$1-$2}' filename
awk '$1 > $2' filename
awk '$1 > $2{print}' filename
awk '$1 > $2{print $0}' filename
awk '$1=="foo"{print $2}' filename
awk '/foo.*bar/{print $1,$3}' filename
awk '$2~/foo/{print $3,$1}' filename
awk '$2!~/foo/{print $3,$1}' filename
awk '/foo/,/bar/' filename
awk 'BEGIN{print"fee"} $1=="foo"{print"fi"}
END{print"fo fum"}' filename
awk '{print $1,$NF }' filename
awk '{print NR,$0 }' filename
awk -F: '{print $1,$3 }' /etc/passwd
awk '{$10=""; print }' filename
awk '{for(i=1;i<=NF;i++) print $i }' filename awk '{printf("%s %03d %02d %.15g\n",$1,$2,$3,$3/$2); }' filename
awk '{for(i=NF;i > 0;i--) printf("%s",$i); printf("\n"); }' filename
No comments:
Post a Comment