Artificial intelligent assistant

How to increment line counter for line beginning replacements by AWK/...? I first thought about SED (`sed "s/^/COUNTER \&/" /tmp/1.tex`) but it is designed for a single line, and I cannot increment the counter itself by sed so thinking now `awk` because I have great experiences with `gawk` in integrated approaches. Data What & South Dragon & North Dragon & 5 \\ \hline What & South Dragon & North Dragon & 5 \\ \hline What & South Dragon & North Dragon & 5 \\ \hline Expected output 1 & What & South Dragon & North Dragon & 5 \\ \hline 2 & What & South Dragon & North Dragon & 5 \\ \hline 3 & What & South Dragon & North Dragon & 5 \\ \hline OS: Debian 8.5

`nl` is a utility to number the lines of a file.Usage:


nl /path/to/file


In your specific case:


$ nl -s ' & ' input.txt
1 & What & South Dragon & North Dragon & 5 \\ \hline
2 & What & South Dragon & North Dragon & 5 \\ \hline
3 & What & South Dragon & North Dragon & 5 \\ \hline

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 6b4a706f1e832b9be3a74d5f3f893149