Here is a solution that creates one output file for all participants. You don't have to use any scripting for this, just one LaTeX run is enough. You may want to insert \newpage or \clearpage in the definition of \printCertificate if you wish to start a new page for each participant.
\documentclass{article}
% I use these encodings in order to properly typeset “René Descartes”, which
% is in my participant.txt file. Use encodings appropriate for your situation,
% of course.
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\ExplSyntaxOn
\msg_new:nnn { upsmakeparticlist } { file-not-found }
{ File~'\exp_not:n {#1}'~not~found. }
\cs_new_protected:Npn \ups_call_user_callback:Nn #1#2
{
% Call the user callback (#1) with contents obtained from the file (#2).
#1 {#2}
}
\cs_generate_variant:Nn \ups_call_user_callback:Nn { Nx }
\ior_new:N \g_ups_stream_ior
% #1: macro taking one argument (the participant name)
% #2: file containing one participant per line (blank lines are ignored)
\cs_new_protected:Npn \ups_list_participants:Nn #1#2
{
\ior_open:NnF \g_ups_stream_ior {#2}
{ \msg_error:nnn { upsmakeparticlist } { file-not-found } {#2} }
\ior_map_inline:Nn \g_ups_stream_ior
{
\tl_if_eq:nnF {##1} { \par } % ignore blank lines
{
% Calling \ups_call_user_callback:Nx will *not* trigger expansion
% of user-provided contents from ##1, so this should be safe to use
% (see the documentation of \tl_trim_spaces:n).
\ups_call_user_callback:Nx #1 { \tl_trim_spaces:n {##1} }
}
}
\ior_close:N \g_ups_stream_ior
}
% #1: macro taking one argument (the participant name)
% #2: file containing one participant per line (blank lines are ignored). Must
% be readable by TeX; for instance, it can live in the same directory as the
% .tex document or be somewhere in TEXINPUTS.
\NewDocumentCommand \participantlist { m m }
{
\ups_list_participants:Nn #1 {#2}
}
\ExplSyntaxOff
% Will be our callback function that is called for each participant
\newcommand*{\printCertificate}[1]{%
This is the certificate of #1, etc.\par
}
\begin{document}
\participantlist{\printCertificate}{participant.txt}
\end{document}
Input file participant.txt (may be in TEXINPUTS; for instance, can be in the same directory as the .tex file):
Isaac Newton
Pierre de Fermat
Karl Friedrich Gauss
Henri Lebesgue
William Rowan Hamilton
Georg Ferdinand Ludwig Philipp Cantor
René Descartes
Output:

\endlinechar=-1with\ior_map_inline:Nnis an expl3 bug or the result of a misderstanding of mine? Thanks! (I can make this a new question if you think it's appropriate.) – frougon May 24 '19 at 07:06\endlinechar=-1, egreg replied below my answer (I had put the question there first). – frougon May 24 '19 at 07:20%sfor name andprintfthe actual names in there with a shell. At least bash hasprintfas a built-in. – Oleg Lobachev May 24 '19 at 22:51