I had created a text file called states.txt with a list of states as such:
sed “s/york/York City/g” states.txt
to replace “New york” with “New York City”. I tried to take that output and overwrite states.txt with
sed ‘s/york/York City/g’ states.txt | cat > states.txt
but all I get back is an empty states.txt file.
However, when I try to concatenate it with
sed ‘s/york/York City/g’ states.txt | cat >> states.txt
this seems to work, but I would rather overwrite the original list.
Why does “>” not work in this situation?