Update cheatsheets

This commit is contained in:
ivuorinen
2025-10-15 00:19:37 +00:00
parent 220486abce
commit d5421f7c01
42 changed files with 459 additions and 43 deletions

View File

@@ -6,20 +6,17 @@ source: https://github.com/tldr-pages/tldr.git
# perl
> The Perl 5 language interpreter.
> More information: <https://www.perl.org>.
> See also: `perldoc`.
> More information: <https://perldoc.perl.org/perl>.
- Print lines from `stdin` [m/] matching `regex1` and case insensitive [/i] `regex2`:
- Print lines from `stdin` [m]atching `regex1` and case [i]nsensitive `regex2`:
`perl -n -e 'print if m/{{regex1}}/ and m/{{regex2}}/i'`
`perl -n -e 'print if m/regex1/ and m/regex2/i'`
- Say [-E] first match group, using a `regex`, ignoring space in `regex` [/x]:
- Say ([-E]) first match group, using a `regex`, ignoring space ([x]) in `regex`:
`perl -n -E 'say $1 if m/{{before}} ( {{group_regex}} ) {{after}}/x'`
- [-i]n-place, with backup, [s/] substitute all occurrence [/g] of `regex` with replacement:
- [i]n-place, with backup, [s]ubstitute all occurrence ([g]) of `regex` with a replacement:
`perl -i'.bak' -p -e 's/{{regex}}/{{replacement}}/g' {{path/to/files}}`
- Use perl's inline documentation, some pages also available via manual pages on Linux:
`perldoc perlrun ; perldoc module ; perldoc -f splice; perldoc -q perlfaq1`
`perl -i'.bak' -p -e 's/regex/{{replacement}}/g' {{path/to/files}}`