且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除“空"来自文本文件 shell 脚本的行

更新时间:2023-12-05 20:31:22

如果列是空格分隔的,如何检查行是否有两个以上的字段?由于 NF 存储了这个值,你可以简单地说:

If the columns are space separated, what about checking that lines have more than two fields? Since NF stores this value, you can simply say:

awk 'NF>2' file

对于给定的输入,它返回:

For your given input it returns:

133 0.00295 nurse merit respect muslim 
134 0.00292 high dangerous reassure full 
136 0.0039  experience darren  
137 0.00097 _ _param_ui_control_scripts_save _param_pattern_value 
138 0.00292 find director