Hi Team,

I am new to shell script.
Do kindly help me remove junk character from a file having a million records.. As it is production setup do kindly advice

Thanks ...
Whizkidash

Recommended Answers

All 5 Replies

Do kindly explain exactly what you need. Junk character means nothing.

hi

Junk character like ^M,#,$

That "^M" is a unix line end, use the dos2unix command first. For the rest use sed.

sed -e 's/[^ -~]//g' file_in > file_out

This really works

i have used this command but how to use it when we do not know how many time it will be repeated????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.