|Perl Monk, Perl Meditation|
Perlify some awk'ing for SPAM graphingby hacker (Priest)
|on Jun 24, 2003 at 13:21 UTC||Need Help??|
hacker has asked for the
wisdom of the Perl Monks concerning the following question:
I'm working on some SPAM graphing with mrtg and gnuplot, and have run into a bit of a conversion I'd like to try to migrate to perl. Basically I have the following:
This returns the following:
What I'm trying to do, is swap the first and second columns, but I can't figure out how to easily do that (either with awk's backtracking, or with this converted into a perl one-liner). Once I can do this (without manually swapping the columns), I'll be shoving it into gnuplot with:
Any ideas on how I can swap those columns either with perl or awk? Or perhaps a better way to do this entirely in perl?
And then I just run gnuplot -persist spam.gnuplot across my control file. Done.
Now to fancy it up a bit and add more heuristics.