perl: add PCRE one liner example (#3129)
This commit is contained in:

committed by
Marco Bonelli

parent
66dd8e6acc
commit
ec2213a34a
@@ -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;}'`
|
||||
|
Reference in New Issue
Block a user