Category Archives: sed

Add line to the top of files with sed

One-liner to add line at the beginning of the file(s). find mirrors-* -exec sed -i 1i’http://webmel53.vsb.cz/hrb33/el$releasever/hrb/stable/$basearch/’ {} \;

Posted in sed | Leave a comment

Sed to correct path lines

Sed one-liner to change correct paths. Before: php_admin_value open_basedir /srv/www/www.domena.tld/www After: php_admin_value open_basedir /srv/www/www.domena.tld Sed script: sed -i "s/\(.*\)php_admin_value open_basedir \(.*\)\/www$/\1php_admin_value open_basedir \2/g" /etc/httpd/conf/httpd.conf

Also posted in regular expressions | Leave a comment