Dear experts,
I have a problem in UNIX text processing that I hope to get some help here.
input file
---
3 <--+
1.2 |
apples orange | This section belongs to (3)
1.7 |
pear banana --+
4 <--+
1.3 |
earth mars |
1.7 | This is another section: (4)
jupiter saturn |
1.13 |
pluto moon --+
---
The requirement is to format the input into the following comma delimited file.
---
3,1.2,apple,orange
3,1.7,pear,banana
4,1.3,earth,mars
4,1.7,jupiter,saturn
4.1.13,pluto,moon
---
I would appreciate any recommendation of the right tool to do this kind of job. Is awk the right choice? Code snippet would be even more appreciated. Thanks in advance.
leekb@bigfoot.com
I have a problem in UNIX text processing that I hope to get some help here.
input file
---
3 <--+
1.2 |
apples orange | This section belongs to (3)
1.7 |
pear banana --+
4 <--+
1.3 |
earth mars |
1.7 | This is another section: (4)
jupiter saturn |
1.13 |
pluto moon --+
---
The requirement is to format the input into the following comma delimited file.
---
3,1.2,apple,orange
3,1.7,pear,banana
4,1.3,earth,mars
4,1.7,jupiter,saturn
4.1.13,pluto,moon
---
I would appreciate any recommendation of the right tool to do this kind of job. Is awk the right choice? Code snippet would be even more appreciated. Thanks in advance.
leekb@bigfoot.com