How can I append a line number and tab to the beginning of each line of a text file?
OK, Here's a one-line bash solution:
$ IFS=$'\n';x=1;for l in $(<file.txt);do echo -e "$x\t$l";((x+=1));done $ IFS=
The first IFS setting tells bash to read a full line at a time. The second line resets the IFS to default.
As an added bonus, it runs completely in your shell and doesn't exec a program!