Why wont sed remove line from file?

后端 未结 4 2022
说谎
说谎 2021-01-21 20:15

I\'m trying to remove a specific line from a file and then append the edited line to the file. I get last part right but my sed command to remove the old line is not working.

4条回答
  •  感动是毒
    2021-01-21 21:14

    In this case you need do this because $ means end of line regular expressions.

    Try:

    sed "/^${userinput}/d" file1.txt >> file2.txt
    

    Also >> will append to the file.

提交回复
热议问题