[OS X TeX] Search and replace in many files

Alain Schremmer schremmer.alain at gmail.com
Tue Sep 4 01:46:13 CEST 2012


I hope the following is not too off topic:

I have a "form" which gives the choice between 3 versions, Quiz,  
Homework, and Exam, of a "testable item":

\ifthenelse{\boolean{Quiz?}}%
	{%begin Quiz? true
		Quiz version
	}%end Quiz? true
	{%begin Quiz false
		\ifthenelse{\boolean{Homework?}}%
			{%begin Homework? true
				Homework version
			}% end Homework? true
			{%begin Homework? false
				Exam version
			}% end Homework? false
	}% end Quiz? false

and I always have anywhere between fifty and a hundred testable items.

What I want to do is to have a fourth version, Workout, in other words  
I want to change the form to:

\ifthenelse{\boolean{Workout?}}%
	{%begin Workout? true
		Workout version
	}%end Workout? true
	{%begin Workout false
		\ifthenelse{\boolean{Quiz?}}%
			{%begin Quiz? true
				Quiz version
			}%end Quiz? true
			{%begin Quiz false
				\ifthenelse{\boolean{Homework?}}%
					{%begin Homework? true
						Homework version
					}% end Homework? true
					{%begin Homework? false
						Exam version
					}% end Homework? false
			}% end Quiz? false
	}% end Workout? false

after which I can enter the "Workout version" on each form.

I tried to use Gerhard's GUI for sed, which I have used in the past  
and works very, very nicely, but, unfortunately, \r does not work in  
Mac's sed and I need to keep the formatting.

Would anyone have a suggestion of what else might do the job? E.g.  
might there be an applescript that would work something like "Replace  
Text In Item Names.scpt"?

Very hopeful regards
--schremmer



More information about the macostex-archives mailing list