good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Perl and Pipes. Share your story.by fizbin (Chaplain) |
on Apr 16, 2006 at 00:12 UTC ( [id://543602]=note: print w/replies, xml ) | Need Help?? |
I'm constantly using perl one-liners in pipes when investigating things; as such, the usage doesn't usually get written down and I can only come up with a few examples in my bash_history file: A simple checklist of stuff to look at generated by a certain subversion commit. Then there's this longer example that requires some setup. See, we have in our source code a bunch of DTD files that are replicated into several different directories. Yeah, we should keep them in one central location, and we're moing there, but right now we don't. Anyway, occasionally a DTD file changes, and the changes are copied to its various versions, but every once in a while we miss something. That's where this usage of perl in the midst of pipes comes in. The output that produces is nothing when all the copies of a given dtd file are in sync. When they aren't, I get something like this: (names tweaked to protect... um ... someone) This tells me that there are 42 copies of this dtd in our source, and 41 of them agree with the dtd stored under "base", but the one for megacorp is different. I then look manually at the two versions. I keep the md5sums in a temp file because sometimes it isn't just 1 spot that has the rogue dtd, but 2 or 3, and I can just grep through the temp. file to find the locations of the rogue dtd.
--
In Section
Seekers of Perl Wisdom
|
|