awk: print column $# if $#==[value]

If you’re looking for a specific value: awk ‘$2==1 {print $3}’ fileawk ‘$2==1 {print $3}’ file If you’re looking for a string, you have to use quotes otherwise awk will assume it’s a variable name: awk ‘$1 == "findtext" {print $3}’ fileawk ‘$1 == "findtext" {print $3}’ file  

Processing text using filters

File-combining commands cat: concatenate; combine an arbitrary number of files and send it to a file. It’s also commonly used to display the content of short files. Options for cat: -E –show-ends see where line ends -n –number add numbers to the beginning of every line -b –number-nonblank numbers only lines that contain text -s –squeeze-blank compress… Continue reading “Processing text using filters”