Hi
I have a text file that looks like this:
A
B
C
D
E
F
G
H
I
I want it to be reformatted to
A;B;C;
D;E;F;
G;H;I;
I want a shell script to do this. Any help is greatly appreciated.
Thanks
Hi
I have a text file that looks like this:
A
B
C
D
E
F
G
H
I
I want it to be reformatted to
A;B;C;
D;E;F;
G;H;I;
I want a shell script to do this. Any help is greatly appreciated.
Thanks
no need of script this sed oneliner will do it..
sed -ne 'H
/^$/{x
s/\n/;/g
s/;//
p
}' filename
$
$ cat f1
A
B
C
D
E
F
G
H
I
$ awk '{if (/^$/){print} else{printf("%s;",$0)}}' f1
A;B;C;
D;E;F;
G;H;I;
$
$
tyler_durden
Thanks tyler_durden and vidyadhar85 for the quick replies!!
Another one
awk 'ORS=(NF)?";":"\n"' file