Print specific columns with awk
Print 1st and 3rd fields of a space-delimited file
awk '{print $1, $3}' /etc/passwd
More linux commands
-
awk '{sum += $2} END {print sum}' file.txtSum values in column 2 of a text file
-
sed -i '/^#/d' config.confRemove all comment lines starting with #
-
sed -n '/START/,/END/p' file.txtPrint block of text between START and END markers
-
sort file.txt | uniq -c | sort -rnCount occurrences of each unique line
-
who -H && wActive user sessions and what they are running