Script to include charecter cama(,) in 3 rd column of a test file

sridhargsr
sridhargsr used Ask the Experts™
on
Hi,

I want the answer for the above question. For example

input file looks like this

sr12333
aa121233
dd1222
aaaaa
aaaaa

I want the output file
sr,12333
aa,121233
dd,1222
aa,aaa
aa,aaa

thanks.  
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2005
Commented:
From the question it looks like you want the ',' to be at the third position on each line. If that is correct you could do:

cp file file.orig
sed -e "s/\(..\)\(.*\)/\1,\2/" <file.orig >file

Author

Commented:
jlevie,

Thanks for the answer, can you please give vi editor command for this.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial