| JP Vossen on 2 Dec 2015 15:01:55 -0800 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| [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