I have this line of output:
M file.txt
Getting fed into this awk program:
awk '{printf("\t%s: %s %s\n", FNR, $1, $2)}'
which returns
1: M file.txt
This works and is the usual case. However, if the file has spaces and the line of output looks something like this:
M "tmux split-window subcommand.md"
awk gives give this:
1: M "tmux
But the desired output is this:
1: M "tmux split-window subcommand.md"
How can I fix this?
nl
orcat -n
would be simpler. If you insist on using awk, you could print the whole record e.g.'{printf("\t%s: %s\n", FNR, $0)}'