Thanks a lot for the great help. It seems exactly what I want. But I couldn't do it ;-(
Actually, I have not adequate experience, yet, in perl or even linux so I need further 
help. I have a file called newfile.lyx that contains (after exporting to Latex)

%% LyX 1.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\makeindex

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\makeindex


\makeatother
\begin{document}

This\index{This} is\index{is} a test.\pagebreak

This\index{This} is another test.

\printindex{}

\end{document}
---------------------------------------------
Now, I tried your command like this

[EMAIL PROTECTED] Desktop]$ perl -pi -e 's:is:\n\\begin_inset LatexCommand 
\\index{is}\n\n\end_inset\n' newfile.lyx
Substitution replacement not terminated at -e line 1.

I also tried it like this ({is}\\index) but the same error:
[EMAIL PROTECTED] Desktop]$ perl -pi -e 's:is:\n\\begin_inset LatexCommand 
{is}\\index\n\n\end_inset\n' newfile.lyx


This is the error message I've got. I am sorry if I seems stupid.



في 3:22 م جمعة 28 فبراير 2003، كتبت:
> On Fri, Feb 28, 2003 at 02:18:42PM +0300, Munzir Taha wrote:
> > But why isn't there any way? Many programs has this feature, I think.
> > Are you sure there is no way!!!!!!!!!!!
>
> [Your keyboard seems to be broken (Bouncing !-key?)]
>
> You can replace every occurence of a Word FOO by
>
>       \begin_inset LatexCommand \index{FOO}
>
>       \end_inset
>
> in your .lyx file by e.g. running
>
>  perl -pi -e 's:FOO:\n\\begin_inset LatexCommand
> \\index{FOO}\n\n\end_inset\n' yourfile.lyx
>
> Or even
>
>   list=`grep 'begin_inset LatexCommand .inde' diss.lyx | cut -c 34- | tr -d
> '}'` for i in $list ; do
>        perl -pi -e 's:$i:\n\\begin_inset LatexCommand
> \\index{$i}\n\n\end_inset\n' yourfile.lyx
>   done
>
> or something similar (make sure you have a backup!).
>
> But I really doubt its usefulness.
>
> Andre'

-- 
Munzir Taha,
New Horizons Computer Learning Centers,
Riyadh, Saudi Arabia

Reply via email to