Tag Archives: sed: -e expression

Replace text in multiple files UBUNTU using sed

Dear All,

There was a situation that we have generated 80K text files  on multiple Ubuntu servers in which by mistake a wrong url has been printed in one of line in the file and to regenerate those 80K files suppose to take more than 4 hours per server .

As those files were generated on Ubuntu servers given a thought to try for using sed command .

by default ‘/’ is option is used in sed command but in our case the replace string was containing ‘/’ as it is a url so i was getting error

sed: -e expression #1, char xx:

so used below solution and command got successfully executed  in 3 mins each server 🙂

sed -i ‘s,abcd.com,xyz.com/lmn,g’ *.txt

-i for replace in place  and last parameter is input file name


Prashant Deshpande






Leave a comment

Filed under Uncategorized