- Code: Select all
sed 's/PATTERN//' FILE
it will output text in which the pattern has been deleted but it doesn't actually modify the file so when I run cat FILE the pattern is still there. I tried redirecting the output to the file itself like this:
- Code: Select all
sed 's/PATTERN//' FILE > FILE
but that deleted all text in the file for some reason. I can solve the problem by redirected the output to an intermediate file then outputting the intermediate files contents to the original file like this:
- Code: Select all
sed 's/PATTERN//' FILE > INTERMEDIATEFILE
cat INTERMEDIATEFILE > FILE
but I'm guessing thats a completely roundabout way to do it and I wouldn't need to do that if I knew how to use the sed command properly.


