[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash command



> Sadly, this can't be done in-place, so you'll either need to use mv to
> replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with
> no substitution) to copy /etc/conf.file.new into /etc/conf.file.

It can be done "inplace" with `rm' in place or `mv':

    (rm /etc/conf.file;
     while read line; do
         echo ${line/old_word/new_word}
     done >/etc/conf.file) </etc/conf.file


-- Stefan


Reply to: