Stefano Franchi wrote:
>
> On 19 Dec, 2006, at 12:53 PM, Charles de Miramon wrote:
>
>> William Adams wrote:
>>
>>> On Dec 19, 2006, at 12:45 PM, Stefano Franchi wrote:
>>>
>>>> Unless I could find a program/editor allowing me to do multiple
>>>> replace over multiple files at once. I am not aware or any such
>>>> programs for Mac/Linux, though?
>>>
>>> The free BBedit Lite could do this.
>>>
>>> I believe the free TextWrangler can as well.
>>>
>>> If you'd liefer stick w/ opensource, smultron can.
>>>
>>> William
>>>
>>
>> You can also use a sed script like this one :
>>
>> ----Clean latex before importing ----
>> #! /bin/sh
>> TEMP=temp-$1
>> cp $1 $TEMP
>> sed '
>> s/\\"e/ë/g;
>> s/\\"i/ï/g;
>> s/\\"u/ü/g;
>> s/\\^i/î/g;
>> s/\\^e/ê/g;
>> s/\\'\''e/é/g;
>> s/\\`a/à/g;
>> s/\\`e/è/g;
>> s/\\^a/à/g;
>> s/\\^o/ô/g;
>> s/\\^u/û/g;
>> s/\\`u/ù/g;
>> s/\\^I/Î/g;
>> s/\\^E/Ê/g;
>> s/\\^O/Ô/g;
>> s/\\^U/Û/g;
>> s/\\`A/À/g;
>> ' $TEMP > temp-out
>> mv temp-out $TEMP
>>
>> #cmp -s $1 $tmp && rm -f $tmp || mv -f $tmp $1
>>
>> ------------------------------------------
>>
>> Save the script under the name cleanlatex, make it executable. Install
>> sed
>> if it is not on your computer (it is generally a standard on Unix) and
>> then
>> run cleanlatex myfile.tex and it will create a temp-myfile.tex
>
> Hi Charles,
>
> many, many thanks. I have never used sed in my life, though, and I
> need a bit further help:
> the converted pattern for accent-acute e is
> \'{e}
>
> which I want to convert to é
>
> Will the pattern be:
>
> s/\\'/\{e\}/é/g;
>
> and similarly for all the other chars?
>
>
> Thanks,
>
> Stefano
>
The problem is to tell the shell that you want to search a quote an not end
the sed expression. You need to escape the quote '
Do you know what shell you are using ? Try from the command line echo
$SHELL. In bash you escape the ' (quote) like that '\''
For example try at the command line :
echo 'Stefano '\'' Franchi'
if it gives Stefano ' Franchi
then a line in your sed script would be :
s/\\'\''{e}/é/g;
Sed scripts are rather powerful but rather tricky to create
Cheers,