Librenix
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

No Starch Press has published my Perl One-Liners book!

Up
vote
Down

My Perl One-Liners book was just published by No Starch Press!

Perl one-liners are small and awesome Perl programs that fit in a single line of code. They do one thing really well—like changing line spacing, numbering lines, performing calculations, converting and substituting text, deleting and printing specific lines, parsing logs, editing files in-place, calculating statistics, carrying out system administration tasks, or updating a bunch of files at once. Perl one-liners will make you a shell warrior: what took you minutes (or even hours) to solve will now take you only seconds! read more...
mail this link | permapage | score:9976 | -pkrumins, March 24, 2014

Perl One-Liners Explained: Handy Regular Expressions

Up
vote
Down

This is the seventh part of a nine-part article on Perl one-liners.

Perl one-liners are short programs that do one and only one task well and they fit on a single line in the shell.

Perl is not Perl without regular expressions, therefore in this part I come up with and explain various Perl regular expressions. Please see part one for the introduction of the series.

This part explains the following regular expressions:
  • Match something that looks like an IP address.
  • Test if a number is in range 0-255
  • Match an IP address
  • Check if the string looks like an email address
  • Check if the string is a decimal number
  • Check if a word appears twice in the string
  • Increase all numbers by one in the string
  • Extract HTTP User-Agent string from the HTTP headers
  • Match printable ASCII characters
  • Match text between two HTML tags
  • Replace all bold tags with strong tag
  • Extract all matches from a regular expression
read more...
mail this link | permapage | score:9571 | -pkrumins, November 11, 2011

E-book: Perl One-Liners Explained

Up
vote
Down

I'm happy to announce my 3rd e-book called "Perl One-Liners Explained."

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.

Here is an example. Suppose you quickly need to generate a random, 8 character password. You can do it quickly with this Perl one-liner:

perl -le 'print map { ("a".."z")[rand 26] } 1..8'

Overall, the e-book has 111 pages and it explains 130 unique one-liners. Many of one-liners are presented in several different ways so the total number of one-liners in the book is over 200. read more...
mail this link | permapage | score:9528 | -pkrumins, February 4, 2012

perl1line.txt: A handy Perl script collection

Up
vote
Down

The ultimate goal of the Perl One-Liners Explained article series was to release the perl1line.txt file. Last week I finished the series and now I am happy to announce perl1line.txt - a collection of handy Perl one-liner scripts.

The perl1line.txt file contains over a hundred short Perl one-line scripts for various text processing tasks. The file processing tasks include: changing file spacing, numbering lines, doing calculations, creating strings and arrays, converting and substituting text, selective printing and deleting of certain lines and text filtering and modifications through regular expressions.

The latest version of perl1line.txt is always at:
http://www.catonmat.net/download/perl1line.txt
Enjoy! It took me over 3 years to write all the one-liners down. read more...
mail this link | permapage | score:9205 | -pkrumins, November 21, 2011

perl dispatch table examples

Up
vote
Down

Dispatch Table: The fancy name for a hash of code-refs...
In perl, code is a first class data type... you can talk about it in the same way you would talk about arrays or hashes, you can take references to them (giving you a code-ref ) and you can de-reference them (which runs the code);

Code-references are just scalars that refers to something, and you get them by using the reference-to operator:
read more...
permapage | score:9073 | -f00li5h, December 17, 2010

Introduction to Perl one-liners

Up
vote
Down

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. Perl one-liners will make you the shell warrior. Anything that took you minutes to solve, will now take you seconds! read more...
mail this link | permapage | score:8788 | -pkrumins, May 28, 2012

Perl: Build a wireless network sniffer

Up
vote
Down

This article reviews common issues of wireless security, and shows how to use open source software to suss out wireless networks, get information about them, and start recognizing common security problems. You will learn how build a lightweight wireless sniffer that runs on open source software and see how simple it is to interact with wireless networks. read more...
permapage | score:8241 | -solrac, January 18, 2005

Perl for the Sysadmin

Up
vote
Down

There are a lot of useful one-liners in this one.
Using perl -e allows you to specify a script right on the command line. It's a powerful, underused feature even for people who use Perl regularly. Perl's powerful command line options make it a more flexible replacement for sed, awk, and even vi. Combine perl -e with the command line editing capability of modern shells and you can, write, test, and debug in record time.

The -p option tells Perl to act as a stream editor similar to sed and awk.
read more...
mail this link | permapage | score:8240 | -Ray, March 23, 2006

Perl tips

Up
vote
Down

Ten perl one-liner tips and tricks...
The core of any perl one-liner is the -e switch, which lets you pass a snippet of code on the command-line:

perl -e 'print "hi\n"' prints "hi" to the console.

The second standard trick to perl one-liners are the -n and -p flags. Both of these make perl put an implicit loop around your program, running it once for each line of input, with the line in the $_ variable. -p also adds an implicit print at the end of each iteration.
read more...
mail this link | permapage | score:8164 | -Ray, June 1, 2010

Book Review: Perl Debugger Pocket Reference

Up
vote
Down

This handy book will only cost you about $10...
One of the most useful methods of checking Perl code, though, is the Perl debugger. Despite the usefulness of this tool, most Perl programmers (including me) never use it. There are a few reasons why we don't use the Perl debugger — we don't know how to use it or feel like learning how to use it is one reason. As part of O'Reilly's monograph (aka Pocket Reference) series, they've recently released a small book on the subject called Perl Debugger Pocket Reference, written by Richard Foley. Although it's small, the book simplifies getting started with the debugger and the price makes it affordable.
read more...
mail this link | permapage | score:7793 | -Ray, April 21, 2004

Perl: Understanding the Command Line

Up
vote
Down

Perl from the shell...
In past columns, I've talked a lot about the Perl language, but have never said much about perl at the Unix shell command line. So, let's fix that by looking at some commonly used command-line constructs for Perl.

Let's take the simplest invocation:

perl my-script

This invokes my-script, using the relative or absolute path to the script as given, thus not using the PATH in any way...
read more...
permapage | score:7785 | -Ray, February 22, 2005

Making Perl graphs with GD::Graph

Up
vote
Down

Need to make graphs for your web site?
The GD::Graph module takes as its input a set of data and produces as its output an image showing a graphical representation of that data. The value of the module comes from its extraordinary flexibility. It can produce graphs of many different types -- line charts, point charts, bar charts, area graphs, and pie charts -- and can mix these to show several data sets in one image. It provides complete control over the graph's axes, tick marks, colours, keys, icons, and logos.
read more...
mail this link | permapage | score:7751 | -Ray, April 14, 2004

Mosaic movies with Perl, ImageMagick, MPlayer

Up
vote
Down

Take a break and have some fun this summer using Perl, ImageMagick, and MPlayer to create mosaic movies. Zoom out from the center of a large text-overlay image made up of sequential frames of existing movies. Disassemble, composite, and encode your own mosaic-type movies for special promotional or home video events. read more...
permapage | score:7659 | -solrac, July 13, 2006

Perl: The Duct Tape of the Internet

Up
vote
Down

An introduction to Perl programming complete with snippets of code.
When you’re a Perl programmer, you never fret about those little ugly tasks that creep up. Perl can deal with file wrangling, text manipulation, and process management in a way unequaled by any other single language, whether open source or proprietary.
read more...
permapage | score:7574 | -Ray, January 2, 2003

XForms with Ajax, Java, Perl, and PHP

Up
vote
Down

These easy to understand XForms tips show you how to get the most out of your XForms. In this XForms and Perl tip, you'll learn how to submit an XForms form using POST to a Perl script, and capture the data for later use. This tip shows you how to access the submitted XForms data using a Java servlet. This tip looks at both the XForms and Ajax versions and how to combine the two techniques and in this XForms and PHP tip, you will see how to create a PHP script that can receive and work with XML data submitted by an XForms form. read more...
mail this link | permapage | score:7546 | -solrac, October 17, 2006

Perl: Delicious DBIx::Class::Candy

Up
vote
Down

The first in a series of articles covering interesting tools that make programming perl easier on the fingers and even on the eyes ...

This article covers using DBIx::Class::Candy to define and deploy a simple schema with next to no effort

(here are some fine art posters) read more...
permapage | score:7492 | -f00li5h, February 22, 2011 (Updated: April 24, 2012)

Build a keystroke dynamics monitor with Perl and xev

Up
vote
Down

Learn how to use Perl, xev, and algorithms to monitor who is currently at the keyboard. Keystroke dynamics is a new field that enables identification of individuals through statistical analysis of their typing patterns. This article presents tools and code allowing you to move beyond a single application of keystroke dynamics, and monitor your entire X Window System environment continuously for characteristic patterns of the typist. read more...
permapage | score:7191 | -jmalasko, October 15, 2008

Tutorial: Fast Perl Scripts with SpeedyCGI on Debian

Up
vote
Down

This tutorial shows how to install and use SpeedyCGI (also known as PersistentPerl) on a Debian Etch system. SpeedyCGI is a way to run Perl scripts persistently, which can make them run much more quickly. It keeps the Perl interpreter running, and during subsequent runs, this interpreter is used to handle new executions instead of starting a new Perl interpreter each time. read more...
permapage | score:7184 | -falko, September 14, 2007

Tutorial: Automating Perl Database Applications

Up
vote
Down

Use Perl and CGIScripter to generate multi-platform Perl CGI code...
This article describes how Perl is used to generate Perl CGI code using the multi-platform CGIScripter application. The resulting output code automates SQL table creation commands (in this example, for a MySQL database), HTML pages and Perl code. Web security issues, data validation and image handling functionality are incorporated into the resulting Perl code. By automating the development of Perl CGI scripts, even entry-level developers can create CGI scripts that contain most of the commonly requested features in a short period of time--without manually writing any code.
read more...
mail this link | permapage | score:7103 | -Ray, January 15, 2004

A Perl script to change timestamps In EXIF Tags

Up
vote
Down

My collection of digital photos is growing.

Finally, threatened with an avalanche of digital images, I have turned to an off-the-shelf photo management software. Only to discover that most of the common packages expect accurate information from the timestamps in the EXIF META tags inside JPEG images. With almost fifteen hundred photographs, I discovered that there was a problem with the date information in my photos.

It might be possible to fix them but the process that did it would have to be a batch process.

So I wrote this script... read more...
mail this link | permapage | score:7064 | -Gerry Patterson, February 22, 2008
More articles...
Abstract Art on Acrylic Panels

Recent headlines

Tutorial: Install Debian 7 (testing) with debootstrap from a Grml live Linux

10 basic examples of Linux ps command

Tutorial: Running CS-Cart on Nginx on Debian 7/Ubuntu 13.04

Tutorial: Automatically add a disclaimer to emails with alterMIME (Postfix on Debian 6)

Debian 6, Squid, Kerberos/LDAP authentication, Active Directory integration, Cyfin Reporter

Setup Nginx + php-FPM + apc + MariaDB on Debian: The perfect LEMP server

Virtual Users/Domains with Postfix/Courier/MySQL/SquirrelMail (Debian 7)

PC-BSD 9.1 preview

Stella: RH/CentOS 6.3 based Desktop OS

LinSSID – Graphical wireless scanning for Linux

Upgrade Fedora 18 to 19 With FedUp

Pipelight – Using Silverlight in Linux browsers

Install openQRM 5.1 on Debian 7

LG 8-inch G Pad 8.3 Android tablet

How to install Ajenti on Ubuntu 13.04 server

Tutorial: Debian 7 Samba Server with tdbsam

Linux Mint Debian 201204 MATE/Cinnamon review

Pre-release Ubuntu 12.10 has partial support for manual LVM and disk encryption

Tutorial: Webcam streaming your desktop plus audio with ffmpeg, crtmpserver, Flowplayer

Giada – Audio tool for DJs, live performers and electronic musicians

HowTo: HTTP Status: 206 Partial Content and Range Requests Using Curl

ROSA Desktop Fresh R1: For advanced users, but even better for new users

Nuvola Player: Enjoy all your Cloud music services from one interface

webOS: The latest Linux distribution

Dual-boot Windows 7 and Ubuntu 12.04 on a PC with UEFI board, SSD and HDD

Tahoe Least-Authority File System for secure, distributed data storage

Install Cinnamon on Fedora 19

Unix: Shell Script Wrapper Examples

Hand of Thief trojan and your favorite Linux distribution

I quit using Linux because…

Plasma Media Center 1.1 and digiKam 3.3

OpenShift Online: a non-developer guide

Epoptes – Open source computer lab management and monitoring tool

Ubuntu Edge: Is there life after an unsuccessful crowd-funding campaign?

Sagemath in the Cloud and Sagemath 5.11

Tutorial: Replace Windows with Ubuntu 13.04

ATA over Ethernet (AoE) (Ubuntu 12.04)

Usability, user-friendliness and the Linux desktop

High-resolution text console with uvesafb in Debian/Ubuntu

Linux mail command examples: send mails from command line

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin