Friday, April 19, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 25224  / 1 Year ago, tue, november 1, 2022, 1:13:04

I have file that was created by copying content from DOCX document with LibreOffice into text file. I have modified file with sed to remove additional spaces and other stuff but then I noticed space that was immune to regular command:



sed -r 's:some-text :some-text:g' -i file


After using cat -A file I found out that this looks like this:



<p>M-BM- Lorem ipsum</p>


How to remove it?


More From » command-line

 Answers
0

After trying a lot of things, I have finally found solution. To replace that weird character with sed, you need to copy and paste exact text that contains that weird space near it, and then paste it directly into sed command:



sed -r 's:paste-here:<p>:g' -i file



Which will look like this in sed command:



sed -r 's:<p> :<p>:g' -i file



but it will work anyway.


[#29047] Wednesday, November 2, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
uxuriousrnal

Total Points: 279
Total Questions: 106
Total Answers: 96

Location: Fiji
Member since Wed, Mar 29, 2023
1 Year ago
uxuriousrnal questions
Wed, Mar 9, 22, 09:04, 2 Years ago
Mon, Jul 18, 22, 01:48, 2 Years ago
Wed, Apr 13, 22, 01:15, 2 Years ago
Thu, Aug 26, 21, 22:01, 3 Years ago
;