Handling Invisible character in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Handling Invisible character in a file
# 1  
Old 01-13-2011
Question Handling Invisible character in a file

Hi Experts,
When i am trying to read a csv file ,i could find some invisible character in it.
I tried to see those characters by following code
Code:
od -c filename

It is displaying 240 for those invisible character.

can some one elobrate on this and provide solution remove those character from file.


Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples!

Last edited by Franklin52; 01-14-2011 at 05:25 AM..
# 2  
Old 01-13-2011
Code:
sed "s/$(printf "\240")//g" file

# 3  
Old 01-14-2011
Hi,
Can you let me know what does 240 implies?
# 4  
Old 01-14-2011
It is extended ascii so it can have all kinds of meanings, depending on the original ASCII extended character set. 240 octal = ascii 160 decimal, which may have had the meaning of a non-breaking space.... So if that was the case then it is maybe best to replace it with a regular space:
Code:
sed "s/$(printf "\240")/ /g" file

# 5  
Old 01-14-2011
Hi,
Is there any other character which also results in non-breaking space similar to \240
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

To remove any invisible and special characters from the file(exclude @#!$*)

Hi Guys, My requirement is to remove any invisible and special characters from the file like control M(carriage return) and alt numerics and it should not replace @#!$% abc|xyz|acd¥£ó adc|123| 12áí Please help on this. Thanks Rakesh (1 Reply)
Discussion started by: rakeshp
1 Replies

2. UNIX for Beginners Questions & Answers

To remove any invisible and special characters from the file(exclude @!#$&*)

Hi Guys, My requirement is to remove any invisible and special characters from the file like control M(carriage return) and alt numerics and it should not replace @#!$% abc|xyz|acd¥£ó adc|123| 12áí Please help on this. Thanks Rakesh (1 Reply)
Discussion started by: rakeshp
1 Replies

3. UNIX for Advanced & Expert Users

NCurses not handling hindi half character correctly

Hello, I am working on Ubuntu's Virtual terminal. On the virtual terminal, I am typing in hindi language. Most of the characters are being correctly typed, but in case of typing of a half character, problem is occuring. A hindi character is 'converted' into half by typing ' ् ' after the... (0 Replies)
Discussion started by: syed.waris
0 Replies

4. Virtualization and Cloud Computing

Invisible/Transparent Background in VM

Hello, If you switch to "seamless mode" in virtualbox, you can see the taskbar of the OS on your screen , like having a transparent background on your VM. My question: is there a possibility to do the same in VMware's Workstation (7) ? I know and use the "Unity" mode in Workstation/Player, but... (0 Replies)
Discussion started by: al0x
0 Replies

5. UNIX for Dummies Questions & Answers

Removing invisible files

hi I have lots of invisable files under a file structure which i would like to delete from the top level rather than going down into each folder. All the files start with ._ these are stub files that get generated. Does anyone have a script that will do this please thanks Treds (7 Replies)
Discussion started by: treds
7 Replies

6. Shell Programming and Scripting

Deleting all characters from 350th character to 450th character from the log file

Hi All, I have a big log file i want to delete all characters (between 350th to 450th characters) starting at 350th character position to 450th character position. please advice or sample code. (6 Replies)
Discussion started by: rajeshorpu
6 Replies

7. 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

8. Shell Programming and Scripting

Null Character Handling

Hi All, I have a problem with Null values while reading line by line from a text file. I wrote a shell script to read set of file names from a text file line by line, and zipping the each individual file and copying those zip files into some separate directory, and removing the original file... (3 Replies)
Discussion started by: npk2210
3 Replies

9. UNIX for Advanced & Expert Users

Invisible login

Hello! My 1st post here, and I am not so sure if it belongs to the "Andvanced" category! I have searched very much to find a way to login to a system in such a way, that others will not be able to "see" me, with the "who" command! So, is there anybody here to help me with this? :rolleyes: ... (1 Reply)
Discussion started by: SmileKilled
1 Replies

10. UNIX for Dummies Questions & Answers

Identifying invisible characters in Unix file

I have a file, which when you look at it, appears as if it has spaces.... But sometimes, it is has tab or Nulls or some other character which we are not able to see..... How to find what character exactly it is in the file, where ever we are seeing a space... (Iam in solaris)... (1 Reply)
Discussion started by: thanuman
1 Replies
Login or Register to Ask a Question