Home > OS >  Replace Chinese characters matching question under Linux
Replace Chinese characters matching question under Linux

Time:10-18

Requirements: "east" in the text, the following words in Linux replacement is empty,

123. TXT text content:
The 2019-04-18 | east 12 south northwest | | around up and down
Around up and down the 2019-04-18 | 345 east southwest north | |
Around up and down the 2019-04-18 | 6789 north south east west | |
Up and down the 2019-04-18 | 123456789 q | Chinese characters about |

Note: separators for "|", the corresponding GBK code: 7 c
The word "q", the corresponding GBK code: 8696
The word "east", the corresponding GBK code: 967 c

The orders to replace: sed -r -i "s/[\ x96 - \ x96] [\ x7C - \ x7C]//g" 123 TXT

According to the requirements, using the sed command normal matched to the 1-3 ways to replace "east" word, but the fourth data "q |" these two characters combined GBK code is: 86967 c, lead to the sed command can match, perform error replacement, excuse me under which a great god under the guidance of how to correctly fit to replace?
  • Related