Print last word of line:awk '{print $NF}' Print lines between two linesawk '/keyword1/,/keyword2/' Change the field separator to / and get the last word/bin/pwd | awk 'BEGIN { FS = "/" } ; { print $NF }' works also with awk -F "/" '{ print $NF }' Example to get fields from a .csv into a flat fileawk 'BEGIN { FS = "," } ; { print $2 " " $9 }' /path/to/file.csv | sed 's/"//g' Remove line if 2 field is emptyawk '$2!=""' Use printf instead of print to print without the newline Also see cut