Hello, Forum!
I've got a small problem.
I'm writing an essay for school(uni) and I want to do the typesetting in (Te)TeX, cos it renders things all lovely, and I need to put a few arabic words in there and TeTeX, well, renders Arabic transliteration all lovely:)
I've just written plain text files, but now I need to do some pattern replacements for my footnotes. Basically in my text files I've got the pattern (NOTE: ...text...) which I need to replace with \footnote{...text...}.
I know I can do this with regexps in my editor easier than standard search & replace, but I'm not sure exactly how it works.
I've got Unix sed and awk and what have ye as well, but I don't know how to use them.
If anyone could give me some pointers, I'd be much full of grate.
Tar,
Paws
ot - I need a geek (regexps or similar)
-
noisetonepause
- Posts: 4938
- Joined: Sat Dec 28, 2002 3:38 pm
- Location: Sticks and stones
ot - I need a geek (regexps or similar)
Suit #1: I mean, have you got any insight as to why a bright boy like this would jeopardize the lives of millions?
Suit #2: No, sir, he says he does this sort of thing for fun.
Suit #2: No, sir, he says he does this sort of thing for fun.
man, this topic is waaay OT
if the text you need to search for is -
(NOTE: ...text...)
then search for ^\(NOTE:(.+)\)$
and replace with \footnote{$1}
if the text you need to search for is -
NOTE: ...text...
then search for ^NOTE:(.+)$
and replace with \footnote{$1}
this is posix. if you're using textpad, use \1 instead of $1 in the replacement expression.
if the text you need to search for is -
(NOTE: ...text...)
then search for ^\(NOTE:(.+)\)$
and replace with \footnote{$1}
if the text you need to search for is -
NOTE: ...text...
then search for ^NOTE:(.+)$
and replace with \footnote{$1}
this is posix. if you're using textpad, use \1 instead of $1 in the replacement expression.
get perl. if it is a small text file, then
(your standard perl heading goes here)
$pattern= the old thing; # you need to escape this properly
$newpattern = the new thing; # same as above
while(1){
$modifiedString = $_;
$modifiedString =~ s/$pattern/$newpattern/g;
print $modifiedString;
}
pipe the text file to the above script
(your standard perl heading goes here)
$pattern= the old thing; # you need to escape this properly
$newpattern = the new thing; # same as above
while(1){
$modifiedString = $_;
$modifiedString =~ s/$pattern/$newpattern/g;
print $modifiedString;
}
pipe the text file to the above script
UTENZIL a tool... of the muse.
-
noisetonepause
- Posts: 4938
- Joined: Sat Dec 28, 2002 3:38 pm
- Location: Sticks and stones