I have a bunch of LyX docs in a folder.

I want to search within the document for few terms so that I can select the documents of my interest. E.g. I have the CV's of 20 persons in LyX format. I have to search which of these CV's mention xml.

The Windows utility does not allow search within the LyX file. What are my options? I do not want to generate pdf and do so.

Also is there any LaTeX package, which generates tags from document content?

closed as off-topic by Schweinebacke, Mensch, Stefan Pinnow, user36296, Zarko Aug 10 '17 at 11:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Schweinebacke, Mensch, Stefan Pinnow, user36296, Zarko
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Your second question is so completely different that I think you should write a new question about that. – Torbjørn T. Jan 7 '14 at 8:45
  • 1
    Use grep. A .lyx file is just a text file. I don't know what the best way to do that on Windows is. – scottkosty Jan 7 '14 at 10:50
  • Or if you want a Windows-hackishy solution (it pains me to suggest this), rename your .lyx files to .txt and then use the Windows search within file option. – scottkosty Jan 7 '14 at 10:51
  • 1
    IMHO this question does not fall in the scope of TSX. It is more a Windows and file searching option than a TeX question. – Schweinebacke Aug 10 '17 at 10:54

Many files

Had you used Linux I would have said grep xml *.lyx, but as you are on Windows that is not available. There are several programs that offer similar functionality though including AstroGrep (via https://superuser.com/a/60174) and Grepwin (via Paolo Cereda in chat). A more drastic solution is Cygwin, which is a Linux-like environment for Windows. In the Cygwin terminal you can use grep as mentioned above.

There is a similar tool available in the Windows command line though, findstr (via https://superuser.com/a/198474). Open a command prompt, cd to the directory containing the .lyx files, and execute

findstr /s /m xml *.lyx

You can save the output to a text file with > out.txt, i.e.

findstr /s /m xml *.lyx > out.txt

For a small number of files

You could open all of the files at the same time in LyX and use LyX's advanced search function:

Edit --> Find & replace (Advanced). Go to the Settings tab in the search panel and select Open files.

enter image description here

  • There are more than 500 files. Is opening all the files feasible? – Vaibhav Jan 7 '14 at 9:32
  • @user34083 Probably not, I updated my answer a little. – Torbjørn T. Jan 7 '14 at 17:22

Under Windows, one can use FART - Find And Replace Text. FART provides a minimalistic interface to the well-known grep. The command line option would look like

fart --count --ignore-case *.lyx XML

This would only display the filenames (--count) and perform a case-insensitive search (--ignore-case) of the phrase XML inside *.lyx. As output you'll see a count of the number of occurrences of XML in each file, with only matched files being displayed.

Not the answer you're looking for? Browse other questions tagged or ask your own question.