Keith C. Perry on 3 Dec 2015 09:54:58 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] perl -MO=Deparse


That is very cool.  I knew about the deparse module I just never had a use case.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
Keith C. Perry, MS E.E. 
Owner, DAO Technologies LLC 
(O) +1.215.525.4165 x2033 
(M) +1.215.432.5167 
www.daotechnologies.com

----- Original Message -----
From: "JP Vossen" <jp@jpsdomain.org>
To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
Sent: Wednesday, December 2, 2015 6:01:50 PM
Subject: [PLUG] perl -MO=Deparse

I don't know how I've missed this, but I have.  I love Perl one-liners,
but I never knew you could "deparse" them!

-----
$ perl -MO=Deparse -a -F/:/ -ne 'print "$F[2]\t$F[0]\t$F[6]";'
/etc/passwd | head -n4
-e syntax OK
LINE: while (defined($_ = <ARGV>)) {
    our(@F) = split(/:/, $_, 0);
    print "$F[2]\t$F[0]\t$F[6]";
}

$ perl -a -F/:/ -ne 'print "$F[2]\t$F[0]\t$F[6]";' /etc/passwd | head -n4
0	root	/bin/bash
1	daemon	/usr/sbin/nologin
2	bin	/usr/sbin/nologin
3	sys	/usr/sbin/nologin
-----

Later,
JP
--  -------------------------------------------------------------------
JP Vossen, CISSP | http://www.jpsdomain.org/ | http://bashcookbook.com/
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug