Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get rid of strange characters

Status
Not open for further replies.

cristi

Programmer
Apr 6, 2000
1
RO
I have inside a text file several words with strange characters (ex: HE^@^@^@^@^@^@^@^@^@^@^@^@LLO).If I try to print the text file everything that's on the right of those strange chars on the line is not printed. If I want to get the word HELLO, AWK returns it "HELLO", but with length = 17 chars. I tried also to get the char's ASCII code but it doesn't seem to have one!
 
Not quite sure what you are asking but if you just want to physically remove the rubbish and leave the word HELLO in the file then you can pass the command s/HE.*LLO/HELLO/ in vi or if you need to do it from the command line or in a shell script, try:-<br>cat rubish_file ¦ sed 's/HE.*LLO/HELLO/g' &gt; hello_file<br><br>Hope that helps. <p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top