Posts Tagged ‘sed’

Replase date format in file name

Mass replase date format in filename
Example:

From filename_012017.txt to filename_12017.txt

ls | sed -e 'h;s/_0/_/;x;G;s/^\(.*\)\n\(.*\)$/\ln -s \1 \2/' | sh

mass find and replace

find / -name php.ini | xargs sed -i 's/expose_php = On/expose_php = Off/g'
find / -name php.ini | xargs perl -pi -e 's/expose_php = On/expose_php = Off/i'