Linux Intro - Remove 302 字符
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
cat test.cpp | tr '\240' ' '>111.txt
cat 111.txt | tr -d '\302'>555.txt
posted on 2017-06-07 15:19 fanbird2008 阅读(148) 评论(0) 编辑 收藏 举报