Hi,
I was given a pipe delimited file that has some extra pipes in it. I need to remove them. I delimited the problem area with ~'s So I need to remove all |'s within that field.
Any help would be appreciated.
Thanks,
Eric
ebuilder, you can do this with sed. If you want to remove all pipes between the ~'s, and also remove the ~'s then the command is
sed 's/~[|]*~//g' inputfile > outputfile
If you want retain the ~'s, then it's
sed 's/~[|]*~/~~/g' inputfile > outputfile
Hi Greg,
That makes sense, in fact sed was my first choice, however I was told that it couldn't be done.
I tried that command and have been able to get sed to remove the ~'s but not the pipes between them. I'm using RH 6.2. This field is an HTML field and has |'s scattered throughout like this:
</B> ALL EXC COMET|COUGAR|FAIRLANE|MUSTANG<BR>
any ideas?
another method I have been working on is:
cat prod.dat | awk 'BEGIN { FS = "~" };{$1 = gsub(/\|/,eric)};{print $1 }' >> new.dat
but I clearly have something wrong in the part where I use the gsub function, the = I think...
thanks,
Eric
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.