views:

27

answers:

1

On a Mac, I have a directory of html files that are all document fragments. Using the TexFinderX app, I was easily able to do a find/replace and add everything at the top of the documents that I wanted (i.e. etc.) .

Now I need to find a way to add the closing tags to all of the documents (i.e. ). TexFinderX does not have a way to do this since the documents do not have anything in common at the end of the files.

Is there a Terminal command that can do this for all html files in a directory and it's subdirectories?

Thanks, Linda

+1  A: 

EDIT:

Well i was trying to keep it simple and avoid Bash scripting but it seems find doesnt allow for output redirection... so try this instead:

for f in ~/html/*.html; do echo "Processing $f file.." && cat ~/close.html >> $f; done


Put your closing tags in a file... well call it close.html and we'll jsut put it in your home directory /Users/youruser/close.html. Well assume your docs are in /Users/youruser/html

Open Terminal.app and do the following command:

find ~/html -type f -name "*.html" -exec cat ~/close.html >> {} \;

youll want to test that first... my find kung-fu is rusty

prodigitalson
edited.... i told you i was rusty :-)
prodigitalson
see the edit to my answer...
prodigitalson
This latest edit does work. Very good.
Linda