输入:
CC2352345|m,safnlasndfmnyxdcvyxcvyxcv |klasjdf |3|lasdjflasdf| |2345567356
CC3543353|asdfasdffghntz |klasjdf |3|lsajdfl | |3456561235
CC5634554|asfjmklasdfassasdasasdsdfas |klasjdf |3|lsajdfl | |2345635636
|masdfjklasdfjasldfjlasjdfklas| | | | |2345234566
CC4723456|asdjkfasjkldfjaklsjdflkajldkfjlasjdflk |klasjdf |2|lsajdfl | |2345234525
DD3455463|asldfklklfaem,.rtklqerktljekltjklqe |klasjdf |3|lsajdfl | |4565467546
输出:
CC2352345|m,safnlasndfmnyxdcvyxcvyxcv |klasjdf |3|lasdjflasdf| |2345567356
CC3543353|asdfasdffghntz |klasjdf |3|lsajdfl | |3456561235
CC5634554|asfjmklasdfassasdasasdsdfas |klasjdf |3|lsajdfl | |2345635636
CC4723456|asdjkfasjkldfjaklsjdflkajldkfjlasjdflk |klasjdf |2|lsajdfl | |2345234525
DD3455463|asldfklklfaem,.rtklqerktljekltjklqe |klasjdf |3|lsajdfl | |4565467546
问题:如何删除第一列为空的行?
答案1
用这个:
sed '/^\s\s*/d' file
甚至:
grep -v '^\s' file
答案2
怎么样awk
,因为没有提到?
awk -F\| '$1~/\w/' file