mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-09-20 08:17:53 +03:00
perl: add PCRE one liner example (#3129)
This commit is contained in:
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;}'`
|
||||
|
Loading…
Reference in New Issue
Block a user