- 论坛徽章:
- 0
|
Hi,
I need to parse a file to a new format:
source file format is like this:
/ABC
abc 0 0 0 0 0 1
efg 0 0 0 0 0 3
/XYZ
cde 0 0 0 0 0 1
fgh 0 0 0 0 0 1
uvw 0 0 0 0 0 2
......
need to parse it to a new file like this:
ABC abc 1
ABC efg 3
XYZ cde 1
XYZ fgh 1
XYZ uvw 2
...
basically what need to be done is to get the name after the slash "/" and combine it with the first and last column of lines immediately after it.
I know a little bit of awk and sed but not enough to solve this problem, any help or hint with a piece of code will be appreciated.
Thanks,
Qing |
|