awk '{print $N}' 截取列
基本结构
awk ' BEGIN{ print "start" } pattern { commands } END{ print "end" } file
awk 'BEGIN { i=0 } { i++ } END{ print i }' filename
awk "BEGIN { i=0 } { i++ } END{ print i }" filename
eg1:
cat 11abc111this9file contains 111 11 888 numbers 00000 > test.txt
替换3位数字,\b是单词边界标记。
cat test.txt | sed 's/\b[0-9]\{3\}\b/NUMBER/g'