Any tip to replacing the special characters in a file
Hi,
Please find attached a file that has special characters on it. It is a copy and paste from a Micro$oft file.
I don't want to use strings as it remove all the 'indentations' / 'formatting' so I am replacing them with space instead.
I am using the sed command below
Note that the sed command above has been specific to what special characters to replace. Is there any way that we can specify a range of special characters to search and replace so we don't need to always find out what is the special character/s to replace and change the sed command to suit?
We're seeing copious amounts of 'NO-BREAK SPACE' (U+00A0) Unicode Characters in your file, represented as multibyte UTF-8 0xC2 0xA0 (or \302 \240 in octal) char. sed definitely is NOT the right tool to cope with those in general (although it might with single occurrences). What encodings does your Microsoft host use? What your *nix node?
Some conversion might already be done during transfer by using the right ftp options / settings. Or use the dos2unix tool. Or iconv or recode commands.
For exactly above problem,
Code:
sed 's/\o302\o240/ /g' /tmp/special_chars.txt
might suffice...
EDIT: I vaguely remember from your recent post that you are using Solaris (you don't mention it here). Not sure if any of above is available, then. YMMV.
Last edited by RudiC; 12-06-2018 at 07:12 AM..
Reason: typos
Hi,
Does anyone know if there is a script or program available out there that uses a conversion table to replace special characters from a file?
I am trying to remove some special characters from a file but there are several unprintable/control characters that some I need to remove but some I... (2 Replies)
**Extremely sorry for the typos in heading
Old:CAST ('${DEFAULT_HIGH_DATE}' AS DATE FORMAT 'YYYY-MM-DD')
New :CAST(CAST('${G_DEFAULT_HIGH_DATE}' AS DATE FORMAT 'MM-DD-YYYY') as DATE FORMAT 'YYYY-MM-DD')
Need to change old format as new format
cat file1
CAST ('${DEFAULT_HIGH_DATE}' AS... (1 Reply)
Hello All,
I am facing challenges in order to transfer a file from windows to unix box,the file contains a special character '×' ,now when I am transferring the file from windows to unix that special character converted to something else like 'Ã' ,another thing I have noticed that the hardware is... (1 Reply)
I am writing a ksh script. I need to replace a set of characters in an xml file.
FROM="ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÛÚÜÝßàáâãäåçèéêëìíîïðñòóôõö¿¶ø®";
TO="AAAAAAACEEEEIIIIDNOOOOOOUUUUYSaaaaaaceeeeiiiionooooo N R"
I have used the code- sed 's/$FROM/$TO/g'<abc.xml
But its not working.
Can anyone tell me the code to do this? (3 Replies)
Hi,
I am trying to replace a string in shell but it is not working correctly.
@xcom.file@
needs to be replaced with
tb137
Plz help.Thx.
Please use and tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. (4 Replies)
HI all,
How can i rename some files and replace the special character in the name with todays date
ex: Name#file1.txt
Name#file2.txt
to be renamed as
Name.20091119.file1.txt
Name.20091119.file2.txt (11 Replies)
Hello,
I have a file with many lines with below format:
\abc\\1234
jkl\\567
def\\345
\pqr\\567
\xyz\\234
Here, i need to do 2 things.
1. replace \\ with \
2. remove starting \
so output to be as below: (11 Replies)
Hi,
I have tonnes of .txt files that are written in French. I need to replace the French special characters, however, with English equivalents (e.g. é -> e and ç -> c).
I have tried this
---
#!/bin/bash
# Convert French characters to normal characters
# Treat each of the files
exec... (4 Replies)
Hi,
I have a file which has special characters. I can't see them when I "vi" the file. But I am sure there are some special un seen characters. How can I see them?
Please help.
Thx (6 Replies)
Hello
I am new to shell scripting and can anyone tell me how to check if there are any special characters in a file. Can i use grep ?
thanks
susie (2 Replies)