Introduction

Use perl to search and replace across many files.

Search and replace

perl -p -i -e 's/hello/hola/g' *.txt

See: perlrun -p

Back-referencing

# '@include align-items(center);' => 'align-items: center;'
perl -p -i -e "s/\@include (align-items)\((.*)\);/\1: \2;/g"

Use \1, \2 to reinsert capture groups.

See: Capture groups

0 Comments for this cheatsheet. Write yours!