awk 常見問題


Posted by BrainChildRalph on December 7, 2018, modified on December 7, 2018

Field Seperator

How to use “:” as awk field separator?

Example:

$ awk -F: '{print $1}' <<< "1:2:3"
1
$ awk -v FS=: '{print $1}' <<< "1:2:3"
1
$ awk '{print $1}' FS=: <<< "1:2:3"
1
$ awk 'BEGIN{FS=":"} {print $1}' <<< "1:2:3"
1
本站總訪問量訪客