Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

petdance (2468)

AOL IM: petdance (Add Buddy, Send Message)
Yahoo! ID: petdance (Add User, Send Message)

I'm Andy Lester, and I like to test stuff. I also write for the Perl Journal, and do tech edits on books. Sometimes I write code, too.

Journal of petdance (2468)

Friday August 24, 2007
10:56 PM

Today's snazzy ack trick

[ #34213 ]
I'm going through a codebase that's got a ton of unused files that have never been pruned. I use ack to look to see if a given file is used, and if not, svn rm the sucker. Then the domino effect starts. Removing that file means that there may well be others, both HTML and graphic, that are no longer used, too. Here's my handy tool to make that easier:

svn diff | grep ^- | ack '(href|src)="(.+?)"' --output='$2' | sort -u

Get the diff, only look at the lines where something's been removed, then find href= or src=, and only show what's in the parens, then sort and dedupe. Voila!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.