Upload
brian-d-foy
View
591
Download
7
Tags:
Embed Size (px)
Citation preview
brian d foy!Saint Perl 6
Perl Power ToolsPerl Power Toolsbrian d foy!Saint Perl 6
BSD!everywhere
addbib apply ar arch arithmetic asa awk banner basename bc cal cat chgrp ching chmod chown
clear cmp col colrm comm cp cut date dc deroff diff dirname du echo ed env expand expr factor false file find fish fold fortune from glob grep hangman
head id install join kill ln lock look ls mail make man maze mimedecode mkdir mkfifo moo morse od par
paste patch pig ping pom ppt pr primes printenv printf pwd rain random rev rm rmdir robots shar
sleep sort spell split strings sum tac tail tar tee test time touch tr true tsort tty uname unexpand uniq units unpar unshar uudecode uuencode wc what
which whois words wump xargs yes
http://goo.gl/upzi9j
s/ppt/PerlPowerTools/gi
��
#!/usr/bin/perl !
print <>;
NAME cat -- concatenate and print files !SYNOPSIS cat [-benstuv] [file ...] !DESCRIPTION The cat utility reads files sequentially, … ! The options are as follows: ! -b Number the non-blank output lines, start- ing at 1. ! -e Display non-printing characters (see the -v option), and display a dollar sign (`$') at the end of each line.
while (<>) { if ($squeeze_empty) { my $is_empty = /^$/; if ($is_empty && $was_empty) { next; } $was_empty = $is_empty; } ! $_ = sprintf "%6d $_", ++ $count if $number_lines || $number_non_blanks && /\S/; ! $_ =~ s/$/\$/ if $ends; if ($nonprinting) { $_ =~ s/([\x80-\xFF])/"M-" . ("\x7F" & $1)/ge; $_ =~ s/([\x00-\x08\x0B-\x1F])/"^" . chr (0100 + ord $1)/ge; $_ =~ s/\x7F/^?/g; } if ($tabs) { $_ =~ s/\x09/^I/g; } ! print; }
github.com/briandfoy/PerlPowerTools
www.perlpowertools.com
Tests!