简体   繁体   中英

How to use the sed command to delete a line from a file

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?

You need / at the beginning of the pattern.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM