Querry Awk /sed help needed

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Querry Awk /sed help needed

Ravi K
Data:
item1 | 100
        | 200
        | 400
        | 600
item2 | 200
        |400
        |500
item3 | 45
         |999

OUtput desired:
item1 | 100
item1 | 200
item1 | 400
item1 | 600
item2 | 200
item2 |400
item2 |500
item3 | 45
item3 |999
Reply | Threaded
Open this post in threaded view
|

Re: Querry Awk /sed help needed

Guru
Administrator
One way:

awk -F "|" '$1 !~ /^ *$/{a=$1}{$1=a}1' OFS="|" file
Reply | Threaded
Open this post in threaded view
|

Re: Querry Awk /sed help needed

Ravi K
In reply to this post by Ravi K
Thanks Guru...pretty neat