how to use sed to replace certain character

MSAgent

Member
May 8, 2001
87
0
0
Unix gurus, i need some help here, suppose i have a line of text like this

111-111-1111~2701~05-AUG-02~05-AUG-02~05-AUG-02~73~

I only want to delete the '-' for 111-111-1111, not from the rest of the line, how do i do this?

thanks for you help!!
 

Psyrex1

Junior Member
Jul 31, 2002
5
0
0
you might have to split it in half before you can do that.
lets say your getting your info from "file" if its a field then just use the echo command.

cat file | awk '{ print substr($0, 1, 12) }' > 1half
cat file | awk '{ print substr($0, 13, 40) }' > 2half

echo $1half | sed "s/-//" > final
complete=`echo "$(final)$(2half)"`

or
echo $1half | awk -F- '(printf ($1, $2, $3))' > final
complete=`echo "$(final)$(2half)"`


i think that might work.
there is probably an easier way to do it but thats all i can think of right now.
if you need my help again then i'm on MSN (elf_psyrex@hotmail.com)