We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,586 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

how to remove junk character

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

5
Contributors
5
Replies
2 Years
Discussion Span
1 Year Ago
Last Updated
6
Views
whizkidash
Newbie Poster
20 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

masijade
Industrious Poster
Team Colleague
4,253 posts since Feb 2006
Reputation Points: 1,484
Solved Threads: 494
Skill Endorsements: 17

hi

Junk character like ^M,#,$

whizkidash
Newbie Poster
20 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

masijade
Industrious Poster
Team Colleague
4,253 posts since Feb 2006
Reputation Points: 1,484
Solved Threads: 494
Skill Endorsements: 17

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

This really works

sulekhaantil
Newbie Poster
1 post since Sep 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

saumitra11
Newbie Poster
1 post since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.0652 seconds using 2.65MB