A collection of inspiring lists, manuals, cheatsheets, blogs, hacks, one-liners, cli/web tools and more.
awesomeawesome-listbsdcheatsheetsdevopsguidelineshackinghackshowtoslinuxlistsmanualsone-linerspentestersresourcessearch-enginessecuritysecurity-researcherssysops
add perl one-liners - signed-off-by: trimstray <[email protected]>
trimstrayb2d6885850b7
diff --git a/README.md b/README.mdindex 12ffb2b..24e1757 100644--- a/README.md+++ b/README.md@@ -1476,6 +1476,7 @@ In Firefox's addressbar, you can limit results by typing special characters befo* [awk](#tool-awk)* [sed](#tool-sed)* [grep](#tool-grep)+ * [perl](#tool-perl)##### Tool: [terminal](https://en.wikipedia.org/wiki/Linux_console)@@ -3831,6 +3832,62 @@ grep -- -- filenamegrep "\-\-" filename```+##### Tool: [perl](https://www.perl.org/)++###### Search and replace (in place)++```bash+perl -i -pe's/SEARCH/REPLACE/' filename+```++###### Edit of `*.conf` files changing all foo to bar (and backup original)++```bash+perl -p -i.orig -e 's/\bfoo\b/bar/g' *.conf+```++###### Prints the first 20 lines from `*.conf` files++```bash+perl -pe 'exit if $. > 20' *.conf+```++###### Search lines 10 to 20++```bash+perl -ne 'print if 10 .. 20' filename+```++###### Delete first 10 lines (and backup original)++```bash+perl -i.orig -ne 'print unless 1 .. 10' filename+```++###### Delete all but lines between foo and bar (and backup original)++```bash+perl -i.orig -ne 'print unless /^foo$/ .. /^bar$/' filename+```++###### Reduce multiple blank lines to a single line++```bash+perl -p -i -00pe0 filename+```++###### Convert tabs to spaces (1t = 2sp)++```bash+perl -p -i -e 's/\t/ /g' filename+```++###### Read input from a file and report number of lines and characters++```bash+perl -lne '$i++; $in += length($_); END { print "$i lines, $in characters"; }' filename+```+#### Shell functions [<sup>[TOC]</sup>](#anger-table-of-contents)##### Table of Contents