regex - shell sed to replace a special character in a text file but unable to replace it -
i trying replace sam_18 sam in text file doesnt produce correct result.
sed -i -e 's/sam_18/sam/g'
it doesnt produce output. bit confused if considering '_' in between special character. help?thanks
option -i
requires file (at least) perform in-place substitution:
sed -i -e 's/sam_18/sam/g' myfile
if no file provided, sed
reads standard input (or input pipe). cannot use -i
in case. like:
cat myfile | sed -e 's/sam_18/sam/g' > newfile
Comments
Post a Comment