So I have a .txt-file and I need to import the data line per line. That works like it should. I need however to adapt the contents loaded into a command an write it to another .txt file that later will be used by the datatool package. Problem is that if I write this:
\documentclass{article}
\begin{document}
\newopen\copyfile % open the file to write to
\openout\copyfile=copy.txt
\newread\file % open the file to read from
\openin\file=file.txt
\loop\unless\ifeof\file
\read\file to\fileline % Read one line and store it into \fileline
\fileline % print the content into the pdf
\write\copyfile{\fileline} % print the content to copy.txt
\repeat
\end{document}
The output file looks like this:
\par
\par
\par
...
While the pdf displays the actual content of the file. Here is an example of a text file for input.
data.txt:
This is the first line.
And the second one.
Here is the third.
And so on...
If anyone has another solution of making datatool skip the first x lines, or even better when reading a certain string, that will solve my problem too in a more efficient way :)
p.s.: I cannot adapt the .txt-files
\expandand\noexpandbtw – Didii Jul 16 '12 at 10:09