If you're using a modern shell like bash or zsh, use $ so that the shell evaluates \t and replaces it with an actual tab:
nl -ba -s $'\t' full_media > full_media2
Even so, if you examine the output, it looks like the default separator is a tab:
$ nl -ba -s $'\t' ~/at.sh | od -c
0000000 1 \t n o h u p s g
$ nl -ba ~/at.sh | od -c
0000000 1 \t n o h u p s g
Indeed, the default separator is tab, as specified by POSIX. From man nl:
-s sep
Specify the characters used in separating the line number and
the corresponding text line. The default sep shall be a <tab>.
To add a column to the CSV, try using Python:
#! /usr/bin/env python2
from sys import stdin, stdout
import csv
csvin = csv.reader(stdin, delimiter='\t')
csvout= csv.writer(stdout, delimiter='\t')
count = 1
for row in csvin:
csvout.writerow ([count] + row)
count = count + 1
Save it as a script (say nl.py) and run:
python2 nl.py < full_media > full_media2
cat -nwork? The command you propose but without-s '\t'seems to work too. What am I missing?cat -nandnl -baprint the line number then a tab, then the original line contents. Maybe we are using different versions of the tools.