BPm
BPm

Reputation: 2994

how to echo tab delimited in csh script

I have a csh script and no matter what I do it never echoes the right tab space.
This is what i want:

header 1    header 2    header 3    header 4

Case 1:

echo header 1 header 2 header 3 header 4 | tabify

Output: It will replace all spaces to tab

Case 2:

echo "header 1\\theader 2\\theader 3\\theader 4"  

or

echo header 1\\theader 2\\theader 3\\theader 4

Output: header 1\\theader 2\\theader 3\\theader 4

Case 3:

echo -e "header 1\\theader 2\\theader 3\\theader 4"

Output: -e header 1\\theader 2\\theader 3\\theader 4

Help? T.T

Upvotes: 1

Views: 5606

Answers (1)

cha0site
cha0site

Reputation: 10737

CShell sucks, but printf will save the day once more.

$ printf 'header 1\theader 2\theader 3\n'
header 1    header 2    header 3

(Please ignore Stack Overflow's inability to show tabs)

Upvotes: 6

Related Questions