I'm trying to delete a word's all occurences in a text file with sed. I have this file f1:
alma a fa
alatt
nyari piros alma
and I'd like to delete all occurences of "alma". I use the following in a .sh script:
a=`sed "s/alma//g" $ file`; echo -e $a | cat > $file
where $file
contains the name of this text file I've just written before. The problem is that sed does not take into account the linefeed and my new f1 file looks like this:
a fa alatt nyari piros.
So everything is written in a single line, however, I'd like to preserve the f1's original form with separate lines.
How could I do that?