[OS X TeX] Search and replace in many files

Alain Schremmer schremmer.alain at gmail.com
Wed Sep 5 19:14:57 EDT 2012


As I was getting desperate, I started making the changes with the  
OgreKit by hand but there are lots and lots of files. Since the  
OgreKit can do it, I was wondering if an applescript could make the  
OgreKit do it---after I have entered the strings in the Ogrekit panel  
by hand.

I googled a lot but that stuff is very hermetic. Could anyone suggest  
a list where I could ask?

Hopeful regards
--schremmer



Here are the four search and replace that I need to make and that the  
Ogrekit does very nicely:

=========================
1	Search string: (Copy full line)

\ifthenelse{\boolean{Quiz?}}%

	Replace string: (Copy two full lines)

%SSSSSSSSSSSS
\ifthenelse{\boolean{Quiz?}}%


=========================
2 	Search string: (Copy only string)

%SSSSSSSSSSSS - Begin CHECKABLE ITEM:

	Replace string:  (Copy only string)

%SSSSSSSSSSSS - Begin CHECKABLE ITEM:
%



=========================
3	Search string: (Copy two full lines)

%SSSSSSSSSSSS
\ifthenelse{\boolean{Quiz?}}%

	Replace string: (Copy all full lines)

%SSSSSSSSSSSS
\ifthenelse{\boolean{Workout?}}%
{%begin Workout? true
%ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss 
  - Begin WORKOUT
\UseProblem{\CheckableItem-w}%
		{%
WORKOUTtext%
		}{%
			$a$%
			}{%
			$b$%
			}{%
			$c$%
			}{%
			$d$%
		}{%
			x%
		}{%
WORKOUTdiscussion%
		}%
%ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss 
  - End WORKOUT
}%end Workout? true
{%begin Workout? false
\ifthenelse{\boolean{Quiz?}}%


=========================
4	Search string:

}% end Quiz? false
% SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS - End  
CHECKABLE ITEM

	Replace string:

}% end Quiz? false
}% end Workout? false
% SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS - End  
CHECKABLE ITEM





More information about the MacOSX-TeX mailing list