Can this be done by sed?

Posted by SpawnCxy on Stack Overflow See other posts from Stack Overflow or by SpawnCxy
Published on 2010-03-18T10:43:58Z Indexed on 2010/03/18 10:51 UTC
Read the original article Hit count: 274

Filed under:

Hiall,I need to deal with a file which seems as follows:

1234
4343
5345345
53453
4343

And what I want to do is to execute follow command to the number of each line:

grep $num1 ./somepath  #get num1_res

Then write $num1 and $num1_res to another file which will be:

1234 32
4343 234
5345345 349
53453 78
#...etc

Any good solution by sed?Or some other simple way?

Thanks.

© Stack Overflow or respective owner

Related posts about bash