Removing all special characters from an file

Posted on 2002-05-30
Last Modified: 2010-03-05
I would like to remove all the special characters from a file and replace it with the closest character possible.

Is there a script that I could use to do this?
Question by:kennybud416
  • 3
  • 3
LVL 84

Expert Comment

ID: 7045404
what characters do you consider special?
and what characters do you consider closest?

Author Comment

ID: 7045618
Any characters that unix can not interpt.

I.e. Dec value 128 to 225
     Hex value 80 to FF
     (both of the above are the same range).

Would it be possible to have a script which would ask me to enter in a letter of my choice to be a replacement (for the special character)?
LVL 84

Accepted Solution

ozo earned 50 total points
ID: 7046256
tr(\x80-\xff)(letters of your choice to be a replacement)
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.


Author Comment

ID: 7047608
Right, but I need a perl script that will work on win32 platforms.  When I transfer the files from windows to unix the special characters are lost.  Thus having no special characters in unix.
LVL 84

Expert Comment

ID: 7048400
tr will work on win32 platforms
How do you transfer the files from windows to unix to lose the special characters?

Author Comment

ID: 7048933
I ftp (ascii). But when I open them up in Solaris 2.6 they are replaced with either nothing or some other weird character.

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now