#! /usr/local/bin/perl5 LINE: while (<>) { if (/^\s*\@Comment/) { next LINE; } if (/^\s*%/) { next LINE; } if (/@.*{(.*),/) { print "\\nocite{$1}\n"; } }