I found a nice one on commandlinefu.com:
grep -R usepackage * | cut -d']' -f2 | cut -s -d'{' -f 2 | sed s/"}"/.sty"}"/g \
| cut -d'}' -f1 | sort | uniq | xargs dpkg -S | cut -d':' -f1 | sort | uniq
It returns the Debian package names corresponding to LaTeX packages used in a document or folder, respectively. Could also combined with find and xargs for checking including subdirectories. This works of couse ony on a TeX installation from Debian or Ubuntu repositories.
This is an example where sed is just used for simple search & replace in a bigger and more general context, combined with command line tools such as sort, uniq and grep.