Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

A shell script used to remove special characters

unix bash shell script

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 ssjdx1

ssjdx1

    CC Regular

  • Member
  • PipPipPip
  • 34 posts

Posted 20 November 2014 - 05:04 AM

Hi all,

I'm fairly new to shell scripting and could use some help.

I am required to create a shell script which will replace special characters such as À, º, ña, basically all sorts of odd looking characters from my files with a blank space or replacement character.

Could anyone please give me a starting point?

The code I have is as follows:

#!/bin/bash

## script.sh ##
_file="${1:-/dev/null}"   #fail safe
while IFS= read -r line
do
  # Do something on $line
  echo "$line"
done < "$_file"

Thanks,

SSJDX1

Edited by dargueta, 31 December 2014 - 06:08 PM.