Home > OS >  How to use the sed command to delete a line from a file
How to use the sed command to delete a line from a file

Time:02-02

Hello I am trying to delete a line from my file but I keep getting this error when i run the command below: sed: -e expression #1, char 1: unknown command

Here is an example of what I am trying to do

sed -i 'something'/d "home/file/something.txt"

What am I doing wrong?

CodePudding user response:

You need / at the beginning of the pattern.

sed -i '/something/d' "home/file/something.txt"
  •  Tags:  
  • Related