Satya's blog - 2005/11/
A Quote from Terry Pratchett's _Going Postal_
Craftsmen. D'you know what that means? It means men with some pride, who get fed up and leave when they're told to do skimpy work in a rush, no matter what you pay them. So I'm employing people as "craftsmen" now who're barely fit to sweep out a workshop. But you don't care, because if they don't polish a chair with their arse all day you think a man who's done a seven-year apprenticeship is the same as some twerp who can't be trusted to hold a hammer by the right end.-- not said aloud by Mr. Pony, chief engineer for the Grand Trunk clacks company.
So I had a bunch of shortcuts to images on my Windows box. After scping them to Linux, I had a bunch of lnk files that had nothing to do with the original files. And binary. So I whipped up a short shell command:
for i in *.lnk do echo ln -s `grep -ao [a-zA-Z0-9_]*.jpg $i` $i donepiped the output of that to
The grep command works with an 'a' for text-mode, 'o' to return just the matched parts (the lnk file contains a full Windows-style path), and the regex matches the filename: any-case letters, number, underline. I know the filenames are limited to that.