SQUARISM addicted to pixels

Using Perl instead of awk or sed

Posted on April 7, 2004

You want to use Perl to process things on the command line but you don't want to write/save a file. You want to replace sed with something more clunky. :)


[user@server tmp]$ ls / | perl -e 'while (){ print $_; }'
bin
boot
dev
etc
home
initrd
lib
lost+found
misc
mnt
opt
proc
root
sbin
tmp
usr
var
[user@server tmp]$ ls / | perl -e 'while (){ print "/" . $_; }'
/bin
/boot
/dev
/etc
/home
/initrd
/lib
/lost+found
/misc
/mnt
/opt
/proc
/root
/sbin
/tmp
/usr
/var

Filed under: Unix Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


Trackbacks are disabled.