Take the 2-minute tour ×
cat report.txt | sed 's/<\/li>/<\/li> \n/g' > report.txt

This obviously results in an empty file.

Is there a mechanism that allows you to store the data before processing it or store the output until the command has finished executing and then write the file?



Sounds like there should be a simple trick to load this into a queue instead of writing it immediately to file, then unload it after the command has finished?

Thanks much!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

What you need is editing in place:

sed -i 's/<\/li>/<\/li> \n/g' report.txt 
share|improve this answer
This would work. I figured out that: echo "$( cat [file] | cmd1 | cmd2 )" > [file] Also works, because the subshell executes first. –  yellobes Jul 9 '12 at 17:11
add comment

Your Answer


