Merlin’s weekly podcast with Dan Benjamin. We talk about creativity, independence, and making things you love.
Merlin’s weekly podcast with Dan Benjamin. We talk about creativity, independence, and making things you love.
”What’s 43 Folders?”
43Folders.com is Merlin Mann’s website about finding the time and attention to do your best creative work.
TextMate projects: faking metadata
Merlin Mann | Oct 18 2004
Wrote this long-winded post to the TextMate list, so I thought I’d repurpose it here. Just quick tips on adding metadata to your text files and—because I’m a dull and repetitive scold—using controlled vocabularies to keep your stuff searchable.
And, per that last bit, I do encourage fellow TextMate nerds to share their productivity tips in comments here. 12 Comments
POSTED IN:
re grep: one interesting thing...Submitted by Mark Eichin (not verified) on October 19, 2004 - 9:11pm.
re grep: one interesting thing you can do, especially once you've started putting in "fake" (ie. unpretentious :-) metadata, is combine find, grep, and xargs to do more advanced searches; for a simple example, find dir -type f | xargs grep -l "chinese food" | xargs grep -l cambridge | xargs grep -n beef would look in every file in dir that contains "chinese food", cambridge, and beef, and print the lines mentioning beef. Breaking it down, find dir walks that directory, -type f says "only deal with files (not links, sockets, or directories)", and given nothing else, just prints the names; xargs command says "take every word on input and run command on it, batching them up as much as practical"; grep -l word files says "look for word in each of files and if you find it, just print out the file name"... and now that we have a list of filenames again, we can start right back in with xargs. The last one in the chain uses -n, instead of -l, to print the line number and filename along with the matched text, instead of only the filename. You might use grep -C for the last step to get "Context" around the hit. The one thing to watch out for is that unlike google, this can be slow, because it looks at each file each time - but Moore's Law has moved many practical values of "slow" into "fast enough for me" :-) » POSTED IN:
|
|
EXPLORE 43Folders | THE GOOD STUFF |