I am trying to replace sam_18 with sam in a text file but it doesnt produce the correct result.
sed -i -e 's/sam_18/sam/g'
It doesnt produce any output. I am a bit confused if it is considering '_' in between as a special character. Any help?Thanks
Option -i
requires a file (at least) to perform the in-place substitution:
sed -i -e 's/sam_18/sam/g' myfile
If no file are provided, sed
reads from the standard input (or an input pipe). You cannot use -i
in that case. You would then do something like:
cat myfile | sed -e 's/sam_18/sam/g' > newfile
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.