Why is sed not recognizing \t as a tab?

Solution 1:

Not all versions of sed understand \t. Just insert a literal tab instead (press Ctrl-V then Tab).

Solution 2:

Using Bash you may insert a TAB character programmatically like so:

TAB=$'\t' 
echo 'line' | sed "s/.*/${TAB}&/g" 
echo 'line' | sed 's/.*/'"${TAB}"'&/g'   # use of Bash string concatenation