用 awk 指令篩選文字檔欄位內容

先取 raw data , 再用 awk 方式來取要的內容

以下範例有注意到差別嗎?

cat login.txt| awk  '{ {split($7,a,":")}print $1,$2 "," $5 a[1] "," $9  }'

result:
[2019-02-01 00:00:00],xxxxxxxxxxxxxxxxxxx,24.27.0.0,2,

 cat login.txt| awk    '{ {split($7,a,":") }  print substr($1,2 ), substr($2,1,8) "," $5 a[1] "," $9 }'


result:
2019-02-01 00:00:00,xxxxxxxxxxxxxxxxxxx,24.27.0.0,2,