I need to insert a hidden HTML input tag into any form tag within a bunch of HTML files. I assume this is possible with sed, but need help forming the command.
My idea is to search for any instance of
<form
and if found, insert a line below it that contains:
<input type="hidden" name="csrf_token" value="$csrf_token" />
What's the best way to tackle this? I'm close with
sed -e '/<form/a\<input type="hidden" name="csrf_token" value="$csrf_token"/>'

aas replace part ? Do you need it ? – Patryk Jan 23 at 15:54\adoesn't work for me. But\nworks like a charm. – Patryk Jan 24 at 8:25