我有一个如下所示的文件,我想删除第四列中没有任何值的行.
Experiment Replica Module Mean
General1 0 scenario.host[229].app
General1 1 scenario.host[229].app 0.00235355
General1 2 scenario.host[229].app
General1 3 scenario.host[229].app 0.0783413
General1 4 scenario.host[229].app
General3 0 scenario.host[229].app
General3 1 scenario.host[229].app 0.540335
General3 2 scenario.host[229].app
General3 3 scenario.host[229].app
General3 4 scenario.host[229].app
General1 0 scenario.host[229].app
Run Code Online (Sandbox Code Playgroud)
请尝试以下方法:
awk 'NF>3' file
Run Code Online (Sandbox Code Playgroud)
编辑:根据@AdrianFrühwirth的要求添加:
无论何时你发现自己正在用负面词汇的要求(例如:"我想DELET该行没有 ...")进行第二次来看看你是否能表达以积极的方式(例如:"我要选择的有 ......的行,你通常会发现更容易找到一个好的解决方案,并避免引入双重否定的风险,这使得理解变得更加困难.