In-place processing with grep

前端 未结 9 2097
庸人自扰
庸人自扰 2020-12-25 11:53

I\'ve got a script that calls grep to process a text file. Currently I am doing something like this.

$ grep \'SomeRegEx\' myfile.txt > myfile.txt.temp
$ m         


        
9条回答
  •  無奈伤痛
    2020-12-25 12:25

    cat myfile.txt | grep 'sometext' > myfile.txt

    This will find sometext in myfile.txt and save it back to myfile.txt, this will accomplish what you want. Not sure about regex, but it does work for text.

提交回复
热议问题