in reply to Quickly reading the first line of a large number of files...
head -1 *files | grep "#!" > shebang.txt Obviously a unix/linux answer.
Scott
Do'h! Before anyone else writes, this won't exactly work, since you'll only get the #! line, but not the file it came from. Gimme a second...
Update 2: OK, you didn't ask for the file it came from, so it is a workable solution. If you want the file as well, do the head, do something like this:
@temp = `head -1 *files`; for ($i=0;$i<scalar @temp;$i++) { if ($temp[$i] =~ /^#!/) { #fixed a typo print "$temp[$1-1], $temp[$i]\n"; } }
|
|---|