OSDN Git Service
(root)
/
twpd
/
master.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Regular updates
[twpd/master.git]
/
perl-pie.md
1
---
2
title: Perl-pie
3
category: Development
4
layout: 2017/sheet
5
---
6
7
### About
8
{: .-intro}
9
10
Use `perl` to search and replace across many files.
11
12
### Search and replace
13
14
```sh
15
perl -p -i -e 's/hello/hola/g' *.txt
16
```
17
18
### Back-referencing
19
20
Use `\1` et al.
21
22
```sh
23
# '@include align-items(center);' => 'align-items: center;'
24
perl -p -i -e "s/\@include (align-items)\((.*)\);/\1: \2;/g"
25
```