|
|
发表于 2018-6-12 20:30:46
|
显示全部楼层
回复 4# shootman2
grep -v "^TOTAL" "f:\123.txt"|gawk -F "," "{a=$1;sub(/[[:blank:]]*$/,\"\",a);print a;}"
sub命令的返回值不是你希望得到的结果,参考帮助手册:
http://www.gnu.org/software/gawk ... ml#String-Functions
sub(regexp, replacement [, target])
Search target, which is treated as a string, for the leftmost, longest substring matched by the regular expression regexp. Modify the entire string by replacing the matched text with replacement. The modified string becomes the new value of target. Return the number of substitutions made (zero or one). |
|