Print column1, column5 and column7 of a data file or output of any columns list awk ‘{print $1, $5, $7}’ data_file cat file_name |awk ‘{print $1 $5 $7}’ ls –al |awk ‘{print $1, $5, $7}’ — Prints file_permissions,size and date List all files names whose file size greater than zero. ls –al |awk ‘$5 > [...]
Archive for the ‘AWK and SED’ Category
30 Apr
AWK Tutorial
COINS.txt gold 1 1986 USA American Eagle gold 1 1908 Austria-Hungary Franz Josef 100 Korona silver 10 1981 USA ingot gold 1 1984 Switzerland ingot gold 1 1979 RSA Krugerrand gold 0.5 1981 RSA Krugerrand gold 0.1 1986 PRC Panda silver 1 1986 USA Liberty dollar gold 0.25 1986 USA Liberty 5-dollar piece silver 0.5 [...]