Last Updated: February 25, 2016
·
908
· yachi

search and replace files oneliner

add this to your .bashrc or .zshrc

alias pie="perl -p -i -e "

Usage

basic

pie 's#[search]#[replace]#g' [filenames]

search and replace http with https from files with name ended with html in this git repo

pie 's#http#https#g' `git ls-files|grep html$`

2 Responses
Add your response

I prefer using sed -i.

over 1 year ago ·

good tip! didn't know the -i option, always wondering how to do that with sed

over 1 year ago ·