All we do is check if the first field is numeric (because it also outputs labels header), and if so, sum the packets up on the first column, just like in the previous one-liner. As you can see, knowing Perl one-liners lets you accomplish many tasks quickly.How about getting a list of the names of all users on the system? If you wish to learn more and become really fast in the shell, I suggest you get a copy of my "Perl One-Liners Explained" e-book.
Each parameter of this function uses the default time zone unless a time zone is specified in that parameter.
Be careful not to use different time zones in each parameter unless that is intended.
See In PHP 5 prior to 5.2.7, requesting a given occurrence of a given weekday in a month where that weekday was the first day of the month would incorrectly add one week to the returned timestamp.
Originally I wrote this introduction for my third e-book, however later I decided to make it a part of the free e-book preview and republish it here as this article.
Perl one-liners are small and awesome Perl programs that fit in a single line of code and they do one thing really well.
These things include changing line spacing, numbering lines, doing calculations, converting and substituting text, deleting and printing certain lines, parsing logs, editing files in-place, doing statistics, carrying out system administration tasks, updating a bunch of files at once, and many more. Anything that took you minutes to solve, will now take you seconds! Imagine you are on a remote server and have this file and you need to do the replacement.
Let's look at several examples to get more familiar with one-liners. You can either open it in text editor and execute find-replace or just do it through command line and, bam, be done with it.
The gets edited in-place, meaning Perl opens the file, executes the substitution for each line, prints the output to a temporary file, and then replaces the original file.
How about doing the same replacement in multiple files? generates a list of letters from a to z (total 26).
Then we randomly choose one of the characters through generating a random number in range 0-25, and then we repeat this whole process 8 times! Suppose you want to quickly find the decimal number that corresponds to an IP address.
You can use the The iptables program outputs the packets as the first field.