[TxMt] Concatenating multiple Files
Jonas Steverud
jtvrud at bredband.net
Thu Jun 5 18:07:20 UTC 2008
5 jun 2008 kl. 17.13 skrev marios:
> Hi,
>
> I often have some Project Folders with multiple HTML files.
>
> I need a Shell Script to concatenate them all together into one single
> file, to use in a command.
% cat file1 file2 file3 > targetfile
> Possibly to strip also Header and Body Tags.
This one is a bit trickier, might be some scripts out there that can
process HTML files and do such things as the filtering, but if we for
the sake of the argument assumes that you only want to remove
'<head>' and '<body>', then this should do it (N.B. The apostrofes
and backslashes are important and this assumes that the tags are the
only content on those lines):
% grep -iv '</?\(head\|body\)>' file1 file2 file3 > targetfile
Depending on the edition of the grep command, further parameters
might be needed to make grep keep quiet and only report the (non-)
matching lines and not which file they where found in etc.
HTH.
/Jonas
More information about the textmate
mailing list