[clug] copy/paste of commands, tabs & bash's $'\t'. Any better solutions?

steve jenkin sjenkin at canb.auug.org.au
Tue Jun 18 04:57:12 UTC 2019


One of the problems I have with copy/paste between terminal screens or file is losing tabs.
They get converted to spaces, which is rarely good.

sort & other programs take a “-t” option as the field separator.

	sort -t’	‘ xxx (field sep is tab)

transforms after it’s journey through the copy/paste buffer into:

	sort -t '      ‘ xxx (field sep is multiple blanks)

Which is an error.

I’ve lately read the man page and $’\t’ expands to a tab.

Can’t, AFAICS, be enclosed in soft-quotes:
	 “$’\t’” doesn’t work

This version will survive a journey through the copy/paste buffer.

	sort -t $’\t’ xxx (tab as field sep)

It’s slightly cumbersome, but at least it works.

Anyone got a better solution.

--
Steve Jenkin, IT Systems and Design 
0412 786 915 (+61 412 786 915)
PO Box 38, Kippax ACT 2615, AUSTRALIA

mailto:sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin


More information about the linux mailing list