Home > Software engineering >  How to find PS (paragraph separator character) in file?
How to find PS (paragraph separator character) in file?

Time:11-19

I oppened an XML file in VSCode.

VSCode warned me that there are unusual line terminators, like enter image description here

Using utilities bundled with git bash for windows, or python, how can I find all paragraph separator characters in a file ?

CodePudding user response:

I'm not 100% sure what you are asking for but a good regex should do the job.

CodePudding user response:

This should work in bash, where unicode can be printed like $'\u2029:

sed $'s/\u2029/HERE(&)/g' file.xml
  • & is replaced with the paragraph separator. In a terminal it will probably just look like HERE().

  • Or maybe use sed $'s/\u2029/HERE/g' in case it messes up the terminal.

  • grep $'\u2029' will list lines containing them.

There's also

hd file.xml | grep --color=always 'e2 80 a9'

You can delete them permanently with:

sed -i $'s/\u2029//g' file.xml
  • Related