perl: add PCRE one liner example (#3129)

italian
Zachary Sherwin 2019-09-24 06:00:09 -07:00 committed by Marco Bonelli
parent 66dd8e6acc
commit ec2213a34a
1 changed files with 4 additions and 0 deletions

View File

@ -30,3 +30,7 @@
- Run a multi-line find/replace expression on a file, and save the result in another file:
`perl -p0e 's/{{foo\nbar}}/{{foobar}}/g' {{input_file}} > {{output_file}}`
- Run a regular expression on `stdin`, printing out first capture group for each line:
`cat {{path/to/input_file}} | perl -nle 'if (/.*({{foo}}).*/) {print "$1"; last;}'`