linux:ubuntu_awk_cheat_sheet
Awk Cheat Sheet
Prints Only Column 9
awk '{print $9}'
Print Lines Between 5 And 10 Both Included
awk 'FNR>=5 && FNR<=10' filename
Use : As A Delimiter
awk -F ':' '{print $1,$8}'
Use 2 Delimiters _ And :
awk -F '[_:]' '{print $2}'
Print From Column 7 To End Of Line
cat file |awk '{ print substr($0, index($0,$7)) }'
Split File From Section To Section
awk '/some_section_start/,/end|some_section_stop/' > somefile
linux/ubuntu_awk_cheat_sheet.txt · Last modified: 24/11/2023 12:22 by Allan