Removing all special characters from a string in Bash

后端 未结 3 1725
心在旅途
心在旅途 2020-12-15 09:15

I have a lot of text in lowercase, only problem is, that there is a lot of special characters, which I want to remove it all with numbers too.

Next command it\'s not

3条回答
  •  一生所求
    2020-12-15 09:42

    I am not exactly certain where the text is coming from in your question but lets just say that the "lot of text in lowercase" is in the file called special.txt you could do something like the following but focused more on the characters you want to keep:

    cat special.txt | sed 's/[^a-z  A-Z]//g'
    

    It is a bit like doing surgery with an axe though.

    Another possible solution in the post Remove non-ascii characters from ...

    If the above don't solve your question, please try to provide a bit more details and I might be able to provide a more actionable answer.

提交回复
热议问题