Unable to read special character from the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unable to read special character from the file
# 1  
Old 10-13-2009
Unable to read special character from the file

Hello All,
We are getting files from sftp server through file transmission protocol & after transmission we are removing all the control M
(^M) characters from them.we are expecting various kind of special characters in the files.
we are tried removing '^M' characters through 'dos2unix' command then we are not able to read greek character 'mu' character,'dos2unix' is replacing 'mu' with some unknown boxes (actually it's changing ASCII value of mu to other ASCII value).

When we removed ^M from 'sed' command then : we are not able to read pound character (Britain currency).
The same problem exists 'tr' command.

Can anybody help us on handling the any special character in the files.
# 2  
Old 10-13-2009
Hi.

Can you show the sed you are using?

Code:
sed "s/^M$//" input_file > output_file
or
tr -d '^M' < input_file > output_file

(using ^V ^M to get the ^M character - the ^ does not mean at the start of the line!)
# 3  
Old 10-14-2009
Currently we are getting '^M' characters at the end but it's not compulsory these will come at tend of the line only. So we are using following commands to handle these.

Quote:
sed 's/^M//g'
tr -d '\015' < file1 > file2
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Special character ^@ in CSV file

All, I am having a tough time with Linux and CSV file. My CSV file gets generated from Cognos on Linux machine that contains special characters. At first instance when I do vi <filename> to that file, I can't see anything. I did tail -2 and redirected to another temp file and did vi <filename>,... (2 Replies)
Discussion started by: donadarsh
2 Replies

2. Shell Programming and Scripting

Removing Special Character from File.

Hi, My file has this special character "^M" I would like to remove this characters. eg: abc,abc,^M i tried using sed but doesnt work. i used octal dump command to see special character it returns following: 015 \r Appreciate your reply. (6 Replies)
Discussion started by: pinnacle
6 Replies

3. Shell Programming and Scripting

read the text file and print the content character by character..

hello all i request you to give the solution for the following problem.. I want read the text file.and print the contents character by character..like if the text file contains google means..i want to print g go goo goog googl google like this Using unix Shell scripting... without using... (1 Reply)
Discussion started by: samupnl
1 Replies

4. Shell Programming and Scripting

read in a file character by character - replace any unknown ASCII characters with spa

Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/ Thanks! (1 Reply)
Discussion started by: raghav525
1 Replies

5. Shell Programming and Scripting

parse a file for a special character

hello, How to parse a file to see if a specific line is commented by '#' character? filename: file1 cat file1 ... # /usr/bin/whatever ... thank you (9 Replies)
Discussion started by: melanie_pfefer
9 Replies

6. UNIX for Dummies Questions & Answers

Special character in my file

I have a special character in my file. It displays as a '#' sign but when I do this command I do not find the line. fgrep 'G#ant' file1 I want to replace the special character with another value but I need to know what character it really is. Any ideas on how to replace this '#' value with... (3 Replies)
Discussion started by: Ryan2786
3 Replies

7. Shell Programming and Scripting

delete a special character in file

hi i want to delete a particular character in file. example file name:abcsample abc=bbbqw3/ hidh=ajjqiwio4/ xyx=hakjp/ ........../ ......./ i want to delete that special character (/) in abcsample file Permnently.please give the required commands for my requirement. required... (1 Reply)
Discussion started by: srivsn
1 Replies

8. Shell Programming and Scripting

delete a special character in file

hi i want to delete a particular character in file. example file name:abcsample abc=bbbqw3/ hidh=ajjqiwio4/ xyx=hakjp/ ........../ ......./ i want to delete that special character (/) in abcsample file.please give the required commands for my requirement. thank you (3 Replies)
Discussion started by: srivsn
3 Replies

9. Solaris

Mount a character special file

Hi together I have 2 systems, mars and venus. The configuration is the same. Every system has a SDLT. I will now backup the datas from mars on the tapedevice from venus. I have shareed the tapedevice (venus) and mounted on mars. Now my problem: when I write on the mountet tapedevice, the... (1 Reply)
Discussion started by: MuellerUrs
1 Replies
Login or Register to Ask a Question