|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
unable to remove \240 from a text file
I have a file originally provided from a SQL database on a Windows platform.
I transfer the file via ftp in binary format, remove the ^M's from the end of all lines. I have attempted to use tr ( cat infile | tr -d '\240' ) and sed (cat infile | sed 's/\240//g' ) to remove the occurences of \240 in the file with no luck. I have no problem removing this octal character in vi. If i run the Windows command, 'type infile', \240 shows up as an a with a grave over it. In notepad, it shows up as a space. I need to incorporate into a script a method of deleting these octal characters because other unix commands fail w/ the following error: can't read STDIN: Illegal byte sequence Any ideas would be greatly appreciated. Thx in advance, pat Last edited by pbrowne; 12-19-2008 at 11:14 AM.. |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Code:
sed 's/\\240//g' file |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
tried this - it did not find and replace the \240
there was no change after running this command pat |
|
#4
|
|||
|
|||
|
Hi, try Code:
sed 's/\o240//g' file HTH Chris |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
tried
sed 's/\o240//g' file no luck - didn't know if this was o240 or 0240 so i tried both to no avail thx pat |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Quote:
Code:
# cat file hello \240 world \240hello\240world # sed 's/\\240//g' file hello world helloworld # |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
system shock,
i ran your command and redirected the output to another file: sed 's/\\240//g' file > output_file the output_file still has the \240 characters in it. sorry to be vague. pat |
| Sponsored Links | ||
|
|
![]() |
| Tags |
| shell script, shell scripting, unix commands, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sed to remove 1st two characters every line of text file | ajp7701 | Shell Programming and Scripting | 20 | 06-09-2009 04:06 PM |
| Best way to remove sections of text from a file | cals64 | Shell Programming and Scripting | 8 | 09-22-2008 12:16 PM |
| remove specified text from file | raidzero | Shell Programming and Scripting | 2 | 06-19-2008 09:10 AM |
| remove the text (*@yahoo.com, hotmail.com) from one file | juniorbear | Shell Programming and Scripting | 11 | 06-15-2008 07:37 AM |
| how to remove ^M from windows text file in unix | pragy1999 | Shell Programming and Scripting | 1 | 04-13-2006 10:04 AM |
|
|