问题描述:

I have this input file (space is the separator for the two elements in the line otherwise there is just one element)

a:1

a:1 123

b:2 345

c:3 456

d:4

d:4 456

..

..

I am interested in the output to be

a:1 123

d:4 456

i.e lines which have the preceding field to have just one field.

网友答案:

Try this:

 { if (NF == 1) { getline; print; next; } }
相关阅读:
Top