Output tab character on terminal window
Clash Royale CLAN TAG#URR8PPP
How do I output a tab character (ASCII hex 0x09) on the terminal window ?
In all my experiments the tab character is changed to spaces when it appears on the terminal. E.g.
$ echo -e "xxttyy"
xx yy
which is not want I want since the space between xx
and yy
is filled with 14 spaces and not 2 tab characters. I tried stty tab0
, stty tab1
, stty tab2
and stty tab3
, but all gives the same result.
I am using GNOME Terminal 2.16.0 and Red Hat Enterprise Linux Client release 5.9.
Background:
I want to mouse-select the text on the terminal and paste into Excel. When I do this from Emacs (with 0x09 tabs between the fields) the fields end up in different columns. I like this, and want the same behavior when copy-pasting from the terminal. However, at present all the fields end up as one string in the first column. When I have spaces (0x20) between fields in Emacs, the behavior is the same as when copy-pasting from the terminal.
bash terminal clipboard
add a comment |
How do I output a tab character (ASCII hex 0x09) on the terminal window ?
In all my experiments the tab character is changed to spaces when it appears on the terminal. E.g.
$ echo -e "xxttyy"
xx yy
which is not want I want since the space between xx
and yy
is filled with 14 spaces and not 2 tab characters. I tried stty tab0
, stty tab1
, stty tab2
and stty tab3
, but all gives the same result.
I am using GNOME Terminal 2.16.0 and Red Hat Enterprise Linux Client release 5.9.
Background:
I want to mouse-select the text on the terminal and paste into Excel. When I do this from Emacs (with 0x09 tabs between the fields) the fields end up in different columns. I like this, and want the same behavior when copy-pasting from the terminal. However, at present all the fields end up as one string in the first column. When I have spaces (0x20) between fields in Emacs, the behavior is the same as when copy-pasting from the terminal.
bash terminal clipboard
Could you please specify your OS and terminal emulator application?
– egmont
Nov 20 '16 at 10:49
xclip may be useful as in printf|xclip
– hildred
Nov 21 '16 at 1:04
In the first version of this question I by mistake wroteecho -t
where it of course should have beenecho -e
. Some answers & comments below thus took me too literally. Sorry.
– Axel Bregnsbo
Nov 26 '16 at 9:59
add a comment |
How do I output a tab character (ASCII hex 0x09) on the terminal window ?
In all my experiments the tab character is changed to spaces when it appears on the terminal. E.g.
$ echo -e "xxttyy"
xx yy
which is not want I want since the space between xx
and yy
is filled with 14 spaces and not 2 tab characters. I tried stty tab0
, stty tab1
, stty tab2
and stty tab3
, but all gives the same result.
I am using GNOME Terminal 2.16.0 and Red Hat Enterprise Linux Client release 5.9.
Background:
I want to mouse-select the text on the terminal and paste into Excel. When I do this from Emacs (with 0x09 tabs between the fields) the fields end up in different columns. I like this, and want the same behavior when copy-pasting from the terminal. However, at present all the fields end up as one string in the first column. When I have spaces (0x20) between fields in Emacs, the behavior is the same as when copy-pasting from the terminal.
bash terminal clipboard
How do I output a tab character (ASCII hex 0x09) on the terminal window ?
In all my experiments the tab character is changed to spaces when it appears on the terminal. E.g.
$ echo -e "xxttyy"
xx yy
which is not want I want since the space between xx
and yy
is filled with 14 spaces and not 2 tab characters. I tried stty tab0
, stty tab1
, stty tab2
and stty tab3
, but all gives the same result.
I am using GNOME Terminal 2.16.0 and Red Hat Enterprise Linux Client release 5.9.
Background:
I want to mouse-select the text on the terminal and paste into Excel. When I do this from Emacs (with 0x09 tabs between the fields) the fields end up in different columns. I like this, and want the same behavior when copy-pasting from the terminal. However, at present all the fields end up as one string in the first column. When I have spaces (0x20) between fields in Emacs, the behavior is the same as when copy-pasting from the terminal.
bash terminal clipboard
bash terminal clipboard
edited Nov 26 '16 at 9:56
Axel Bregnsbo
asked Nov 20 '16 at 10:31
Axel BregnsboAxel Bregnsbo
1427
1427
Could you please specify your OS and terminal emulator application?
– egmont
Nov 20 '16 at 10:49
xclip may be useful as in printf|xclip
– hildred
Nov 21 '16 at 1:04
In the first version of this question I by mistake wroteecho -t
where it of course should have beenecho -e
. Some answers & comments below thus took me too literally. Sorry.
– Axel Bregnsbo
Nov 26 '16 at 9:59
add a comment |
Could you please specify your OS and terminal emulator application?
– egmont
Nov 20 '16 at 10:49
xclip may be useful as in printf|xclip
– hildred
Nov 21 '16 at 1:04
In the first version of this question I by mistake wroteecho -t
where it of course should have beenecho -e
. Some answers & comments below thus took me too literally. Sorry.
– Axel Bregnsbo
Nov 26 '16 at 9:59
Could you please specify your OS and terminal emulator application?
– egmont
Nov 20 '16 at 10:49
Could you please specify your OS and terminal emulator application?
– egmont
Nov 20 '16 at 10:49
xclip may be useful as in printf|xclip
– hildred
Nov 21 '16 at 1:04
xclip may be useful as in printf|xclip
– hildred
Nov 21 '16 at 1:04
In the first version of this question I by mistake wrote
echo -t
where it of course should have been echo -e
. Some answers & comments below thus took me too literally. Sorry.– Axel Bregnsbo
Nov 26 '16 at 9:59
In the first version of this question I by mistake wrote
echo -t
where it of course should have been echo -e
. Some answers & comments below thus took me too literally. Sorry.– Axel Bregnsbo
Nov 26 '16 at 9:59
add a comment |
3 Answers
3
active
oldest
votes
Tab is not a printable character. Tab is a control character that usually advances the cursor (but not at the end of line), leaving the characters that it's jumping through unchanged.
gnome-terminal
(and other vte
-based emulators) have a special hack that it tries to preserve tabs for copy-paste purposes, however, it still loses them at a soft linebreak. Other emulators might also have such a hack, but typically they don't.
See also the conversation at https://bugzilla.gnome.org/show_bug.cgi?id=769316.
So are you saying that it should work for me as long as the tabs are not at the end ?
– Axel Bregnsbo
Nov 20 '16 at 11:05
In terminals based on a recent enough VTE: yes. GNOME Terminal 2.16 might be a bit too old for this, though.
– egmont
Nov 20 '16 at 11:09
GNOME 2.16 was released in Sep 2006. The "smart tab" feature of VTE was implemented in Nov 2007. May I kindly recommend you to upgrade your systems to something reasonably recent? :)
– egmont
Nov 20 '16 at 11:15
I have just issued a ticket to IT. If this fixes my issue you deserve a big upvote. However, in that case your answer is confusing. It should start with the sentence "Use gnome-terminal 3.xx".
– Axel Bregnsbo
Nov 20 '16 at 11:27
I'm not going to track down the very exact version where this appeared (some 2.22-ish perhaps), let alone it's not even gnome-terminal itself rather than vte that matters. I silently assume in all my answers I give on this site that the system being used is a sanely recent one, I go into version-dependent details if the change occurred no more than 2-3 years ago. For such an extreme as this one the comments clarify it.
– egmont
Nov 20 '16 at 13:08
|
show 1 more comment
If you use
printf "xxttyy"
that should expand to a real tab-character. The behavior of echo
in regard to bash
has been erratic. I tested bash
on my Debian 7, and found that neither echo -t
nor /bin/echo -t
gave a tab, while printf
did (redirecting the output to a file to be sure). Here is the script:
#!/bin/bash
echo -t "xxttyy"
echo done
/bin/echo -t "xxttyy"
echo done
echo "xxttyy"
echo done
/bin/echo "xxttyy"
echo done
printf "xxttyy"
echo done
and output to the terminal:
-t xxttyy
done
-t xxttyy
done
xxttyy
done
xxttyy
done
xx yydone
That's distinct from the additional problem of putting characters on the terminal screen. As a rule, most terminals only have spaces selectable for cut/paste (irregardless of whether you print a tab or not). For that —
- Is it possible to select tabs as tabs with mouse in urxvt?
Yes you right:echo -t "xxttyy" | hexdump
shows wierd stuff whereasprintf "xxttyy" | hexdump
shows the 0x09 tab character. However still get spaces on the terminal.
– Axel Bregnsbo
Nov 20 '16 at 11:00
My comment above is junk. When I use the properecho -e
the results fromecho
andprintf
piped tohexdump
are identical. The problem is my oldgnome-terminal
version 2.16.0 as another answers points out.
– Axel Bregnsbo
Nov 26 '16 at 10:04
add a comment |
A bit of a tanget, but if all you want is to get the output into your clipboard so you can paste that into Excel, you can try using something like xclip. Note that you might have to install it. With xclip I can write something like this.
echo -e "xxttyy" | xclip -selection c
It is now in my clipboard I can paste it into Excel. If echo doesn't work you can try printf instead.
If you don't want to type all of that every time you can create an alias instead.
alias xclip="xclip -selection c"
echo -e "xxttyy" | xclip
And if nothing else you can always redirect the output you want to a file and just open it in a text-editor and copy what you need as tabs should stay as tabs in the file.
echo -e "xxttyy" > tmpfile.txt
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f324676%2foutput-tab-character-on-terminal-window%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Tab is not a printable character. Tab is a control character that usually advances the cursor (but not at the end of line), leaving the characters that it's jumping through unchanged.
gnome-terminal
(and other vte
-based emulators) have a special hack that it tries to preserve tabs for copy-paste purposes, however, it still loses them at a soft linebreak. Other emulators might also have such a hack, but typically they don't.
See also the conversation at https://bugzilla.gnome.org/show_bug.cgi?id=769316.
So are you saying that it should work for me as long as the tabs are not at the end ?
– Axel Bregnsbo
Nov 20 '16 at 11:05
In terminals based on a recent enough VTE: yes. GNOME Terminal 2.16 might be a bit too old for this, though.
– egmont
Nov 20 '16 at 11:09
GNOME 2.16 was released in Sep 2006. The "smart tab" feature of VTE was implemented in Nov 2007. May I kindly recommend you to upgrade your systems to something reasonably recent? :)
– egmont
Nov 20 '16 at 11:15
I have just issued a ticket to IT. If this fixes my issue you deserve a big upvote. However, in that case your answer is confusing. It should start with the sentence "Use gnome-terminal 3.xx".
– Axel Bregnsbo
Nov 20 '16 at 11:27
I'm not going to track down the very exact version where this appeared (some 2.22-ish perhaps), let alone it's not even gnome-terminal itself rather than vte that matters. I silently assume in all my answers I give on this site that the system being used is a sanely recent one, I go into version-dependent details if the change occurred no more than 2-3 years ago. For such an extreme as this one the comments clarify it.
– egmont
Nov 20 '16 at 13:08
|
show 1 more comment
Tab is not a printable character. Tab is a control character that usually advances the cursor (but not at the end of line), leaving the characters that it's jumping through unchanged.
gnome-terminal
(and other vte
-based emulators) have a special hack that it tries to preserve tabs for copy-paste purposes, however, it still loses them at a soft linebreak. Other emulators might also have such a hack, but typically they don't.
See also the conversation at https://bugzilla.gnome.org/show_bug.cgi?id=769316.
So are you saying that it should work for me as long as the tabs are not at the end ?
– Axel Bregnsbo
Nov 20 '16 at 11:05
In terminals based on a recent enough VTE: yes. GNOME Terminal 2.16 might be a bit too old for this, though.
– egmont
Nov 20 '16 at 11:09
GNOME 2.16 was released in Sep 2006. The "smart tab" feature of VTE was implemented in Nov 2007. May I kindly recommend you to upgrade your systems to something reasonably recent? :)
– egmont
Nov 20 '16 at 11:15
I have just issued a ticket to IT. If this fixes my issue you deserve a big upvote. However, in that case your answer is confusing. It should start with the sentence "Use gnome-terminal 3.xx".
– Axel Bregnsbo
Nov 20 '16 at 11:27
I'm not going to track down the very exact version where this appeared (some 2.22-ish perhaps), let alone it's not even gnome-terminal itself rather than vte that matters. I silently assume in all my answers I give on this site that the system being used is a sanely recent one, I go into version-dependent details if the change occurred no more than 2-3 years ago. For such an extreme as this one the comments clarify it.
– egmont
Nov 20 '16 at 13:08
|
show 1 more comment
Tab is not a printable character. Tab is a control character that usually advances the cursor (but not at the end of line), leaving the characters that it's jumping through unchanged.
gnome-terminal
(and other vte
-based emulators) have a special hack that it tries to preserve tabs for copy-paste purposes, however, it still loses them at a soft linebreak. Other emulators might also have such a hack, but typically they don't.
See also the conversation at https://bugzilla.gnome.org/show_bug.cgi?id=769316.
Tab is not a printable character. Tab is a control character that usually advances the cursor (but not at the end of line), leaving the characters that it's jumping through unchanged.
gnome-terminal
(and other vte
-based emulators) have a special hack that it tries to preserve tabs for copy-paste purposes, however, it still loses them at a soft linebreak. Other emulators might also have such a hack, but typically they don't.
See also the conversation at https://bugzilla.gnome.org/show_bug.cgi?id=769316.
answered Nov 20 '16 at 10:48
egmontegmont
2,6111912
2,6111912
So are you saying that it should work for me as long as the tabs are not at the end ?
– Axel Bregnsbo
Nov 20 '16 at 11:05
In terminals based on a recent enough VTE: yes. GNOME Terminal 2.16 might be a bit too old for this, though.
– egmont
Nov 20 '16 at 11:09
GNOME 2.16 was released in Sep 2006. The "smart tab" feature of VTE was implemented in Nov 2007. May I kindly recommend you to upgrade your systems to something reasonably recent? :)
– egmont
Nov 20 '16 at 11:15
I have just issued a ticket to IT. If this fixes my issue you deserve a big upvote. However, in that case your answer is confusing. It should start with the sentence "Use gnome-terminal 3.xx".
– Axel Bregnsbo
Nov 20 '16 at 11:27
I'm not going to track down the very exact version where this appeared (some 2.22-ish perhaps), let alone it's not even gnome-terminal itself rather than vte that matters. I silently assume in all my answers I give on this site that the system being used is a sanely recent one, I go into version-dependent details if the change occurred no more than 2-3 years ago. For such an extreme as this one the comments clarify it.
– egmont
Nov 20 '16 at 13:08
|
show 1 more comment
So are you saying that it should work for me as long as the tabs are not at the end ?
– Axel Bregnsbo
Nov 20 '16 at 11:05
In terminals based on a recent enough VTE: yes. GNOME Terminal 2.16 might be a bit too old for this, though.
– egmont
Nov 20 '16 at 11:09
GNOME 2.16 was released in Sep 2006. The "smart tab" feature of VTE was implemented in Nov 2007. May I kindly recommend you to upgrade your systems to something reasonably recent? :)
– egmont
Nov 20 '16 at 11:15
I have just issued a ticket to IT. If this fixes my issue you deserve a big upvote. However, in that case your answer is confusing. It should start with the sentence "Use gnome-terminal 3.xx".
– Axel Bregnsbo
Nov 20 '16 at 11:27
I'm not going to track down the very exact version where this appeared (some 2.22-ish perhaps), let alone it's not even gnome-terminal itself rather than vte that matters. I silently assume in all my answers I give on this site that the system being used is a sanely recent one, I go into version-dependent details if the change occurred no more than 2-3 years ago. For such an extreme as this one the comments clarify it.
– egmont
Nov 20 '16 at 13:08
So are you saying that it should work for me as long as the tabs are not at the end ?
– Axel Bregnsbo
Nov 20 '16 at 11:05
So are you saying that it should work for me as long as the tabs are not at the end ?
– Axel Bregnsbo
Nov 20 '16 at 11:05
In terminals based on a recent enough VTE: yes. GNOME Terminal 2.16 might be a bit too old for this, though.
– egmont
Nov 20 '16 at 11:09
In terminals based on a recent enough VTE: yes. GNOME Terminal 2.16 might be a bit too old for this, though.
– egmont
Nov 20 '16 at 11:09
GNOME 2.16 was released in Sep 2006. The "smart tab" feature of VTE was implemented in Nov 2007. May I kindly recommend you to upgrade your systems to something reasonably recent? :)
– egmont
Nov 20 '16 at 11:15
GNOME 2.16 was released in Sep 2006. The "smart tab" feature of VTE was implemented in Nov 2007. May I kindly recommend you to upgrade your systems to something reasonably recent? :)
– egmont
Nov 20 '16 at 11:15
I have just issued a ticket to IT. If this fixes my issue you deserve a big upvote. However, in that case your answer is confusing. It should start with the sentence "Use gnome-terminal 3.xx".
– Axel Bregnsbo
Nov 20 '16 at 11:27
I have just issued a ticket to IT. If this fixes my issue you deserve a big upvote. However, in that case your answer is confusing. It should start with the sentence "Use gnome-terminal 3.xx".
– Axel Bregnsbo
Nov 20 '16 at 11:27
I'm not going to track down the very exact version where this appeared (some 2.22-ish perhaps), let alone it's not even gnome-terminal itself rather than vte that matters. I silently assume in all my answers I give on this site that the system being used is a sanely recent one, I go into version-dependent details if the change occurred no more than 2-3 years ago. For such an extreme as this one the comments clarify it.
– egmont
Nov 20 '16 at 13:08
I'm not going to track down the very exact version where this appeared (some 2.22-ish perhaps), let alone it's not even gnome-terminal itself rather than vte that matters. I silently assume in all my answers I give on this site that the system being used is a sanely recent one, I go into version-dependent details if the change occurred no more than 2-3 years ago. For such an extreme as this one the comments clarify it.
– egmont
Nov 20 '16 at 13:08
|
show 1 more comment
If you use
printf "xxttyy"
that should expand to a real tab-character. The behavior of echo
in regard to bash
has been erratic. I tested bash
on my Debian 7, and found that neither echo -t
nor /bin/echo -t
gave a tab, while printf
did (redirecting the output to a file to be sure). Here is the script:
#!/bin/bash
echo -t "xxttyy"
echo done
/bin/echo -t "xxttyy"
echo done
echo "xxttyy"
echo done
/bin/echo "xxttyy"
echo done
printf "xxttyy"
echo done
and output to the terminal:
-t xxttyy
done
-t xxttyy
done
xxttyy
done
xxttyy
done
xx yydone
That's distinct from the additional problem of putting characters on the terminal screen. As a rule, most terminals only have spaces selectable for cut/paste (irregardless of whether you print a tab or not). For that —
- Is it possible to select tabs as tabs with mouse in urxvt?
Yes you right:echo -t "xxttyy" | hexdump
shows wierd stuff whereasprintf "xxttyy" | hexdump
shows the 0x09 tab character. However still get spaces on the terminal.
– Axel Bregnsbo
Nov 20 '16 at 11:00
My comment above is junk. When I use the properecho -e
the results fromecho
andprintf
piped tohexdump
are identical. The problem is my oldgnome-terminal
version 2.16.0 as another answers points out.
– Axel Bregnsbo
Nov 26 '16 at 10:04
add a comment |
If you use
printf "xxttyy"
that should expand to a real tab-character. The behavior of echo
in regard to bash
has been erratic. I tested bash
on my Debian 7, and found that neither echo -t
nor /bin/echo -t
gave a tab, while printf
did (redirecting the output to a file to be sure). Here is the script:
#!/bin/bash
echo -t "xxttyy"
echo done
/bin/echo -t "xxttyy"
echo done
echo "xxttyy"
echo done
/bin/echo "xxttyy"
echo done
printf "xxttyy"
echo done
and output to the terminal:
-t xxttyy
done
-t xxttyy
done
xxttyy
done
xxttyy
done
xx yydone
That's distinct from the additional problem of putting characters on the terminal screen. As a rule, most terminals only have spaces selectable for cut/paste (irregardless of whether you print a tab or not). For that —
- Is it possible to select tabs as tabs with mouse in urxvt?
Yes you right:echo -t "xxttyy" | hexdump
shows wierd stuff whereasprintf "xxttyy" | hexdump
shows the 0x09 tab character. However still get spaces on the terminal.
– Axel Bregnsbo
Nov 20 '16 at 11:00
My comment above is junk. When I use the properecho -e
the results fromecho
andprintf
piped tohexdump
are identical. The problem is my oldgnome-terminal
version 2.16.0 as another answers points out.
– Axel Bregnsbo
Nov 26 '16 at 10:04
add a comment |
If you use
printf "xxttyy"
that should expand to a real tab-character. The behavior of echo
in regard to bash
has been erratic. I tested bash
on my Debian 7, and found that neither echo -t
nor /bin/echo -t
gave a tab, while printf
did (redirecting the output to a file to be sure). Here is the script:
#!/bin/bash
echo -t "xxttyy"
echo done
/bin/echo -t "xxttyy"
echo done
echo "xxttyy"
echo done
/bin/echo "xxttyy"
echo done
printf "xxttyy"
echo done
and output to the terminal:
-t xxttyy
done
-t xxttyy
done
xxttyy
done
xxttyy
done
xx yydone
That's distinct from the additional problem of putting characters on the terminal screen. As a rule, most terminals only have spaces selectable for cut/paste (irregardless of whether you print a tab or not). For that —
- Is it possible to select tabs as tabs with mouse in urxvt?
If you use
printf "xxttyy"
that should expand to a real tab-character. The behavior of echo
in regard to bash
has been erratic. I tested bash
on my Debian 7, and found that neither echo -t
nor /bin/echo -t
gave a tab, while printf
did (redirecting the output to a file to be sure). Here is the script:
#!/bin/bash
echo -t "xxttyy"
echo done
/bin/echo -t "xxttyy"
echo done
echo "xxttyy"
echo done
/bin/echo "xxttyy"
echo done
printf "xxttyy"
echo done
and output to the terminal:
-t xxttyy
done
-t xxttyy
done
xxttyy
done
xxttyy
done
xx yydone
That's distinct from the additional problem of putting characters on the terminal screen. As a rule, most terminals only have spaces selectable for cut/paste (irregardless of whether you print a tab or not). For that —
- Is it possible to select tabs as tabs with mouse in urxvt?
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Nov 20 '16 at 10:39
Thomas DickeyThomas Dickey
52.4k595166
52.4k595166
Yes you right:echo -t "xxttyy" | hexdump
shows wierd stuff whereasprintf "xxttyy" | hexdump
shows the 0x09 tab character. However still get spaces on the terminal.
– Axel Bregnsbo
Nov 20 '16 at 11:00
My comment above is junk. When I use the properecho -e
the results fromecho
andprintf
piped tohexdump
are identical. The problem is my oldgnome-terminal
version 2.16.0 as another answers points out.
– Axel Bregnsbo
Nov 26 '16 at 10:04
add a comment |
Yes you right:echo -t "xxttyy" | hexdump
shows wierd stuff whereasprintf "xxttyy" | hexdump
shows the 0x09 tab character. However still get spaces on the terminal.
– Axel Bregnsbo
Nov 20 '16 at 11:00
My comment above is junk. When I use the properecho -e
the results fromecho
andprintf
piped tohexdump
are identical. The problem is my oldgnome-terminal
version 2.16.0 as another answers points out.
– Axel Bregnsbo
Nov 26 '16 at 10:04
Yes you right:
echo -t "xxttyy" | hexdump
shows wierd stuff whereas printf "xxttyy" | hexdump
shows the 0x09 tab character. However still get spaces on the terminal.– Axel Bregnsbo
Nov 20 '16 at 11:00
Yes you right:
echo -t "xxttyy" | hexdump
shows wierd stuff whereas printf "xxttyy" | hexdump
shows the 0x09 tab character. However still get spaces on the terminal.– Axel Bregnsbo
Nov 20 '16 at 11:00
My comment above is junk. When I use the proper
echo -e
the results from echo
and printf
piped to hexdump
are identical. The problem is my old gnome-terminal
version 2.16.0 as another answers points out.– Axel Bregnsbo
Nov 26 '16 at 10:04
My comment above is junk. When I use the proper
echo -e
the results from echo
and printf
piped to hexdump
are identical. The problem is my old gnome-terminal
version 2.16.0 as another answers points out.– Axel Bregnsbo
Nov 26 '16 at 10:04
add a comment |
A bit of a tanget, but if all you want is to get the output into your clipboard so you can paste that into Excel, you can try using something like xclip. Note that you might have to install it. With xclip I can write something like this.
echo -e "xxttyy" | xclip -selection c
It is now in my clipboard I can paste it into Excel. If echo doesn't work you can try printf instead.
If you don't want to type all of that every time you can create an alias instead.
alias xclip="xclip -selection c"
echo -e "xxttyy" | xclip
And if nothing else you can always redirect the output you want to a file and just open it in a text-editor and copy what you need as tabs should stay as tabs in the file.
echo -e "xxttyy" > tmpfile.txt
add a comment |
A bit of a tanget, but if all you want is to get the output into your clipboard so you can paste that into Excel, you can try using something like xclip. Note that you might have to install it. With xclip I can write something like this.
echo -e "xxttyy" | xclip -selection c
It is now in my clipboard I can paste it into Excel. If echo doesn't work you can try printf instead.
If you don't want to type all of that every time you can create an alias instead.
alias xclip="xclip -selection c"
echo -e "xxttyy" | xclip
And if nothing else you can always redirect the output you want to a file and just open it in a text-editor and copy what you need as tabs should stay as tabs in the file.
echo -e "xxttyy" > tmpfile.txt
add a comment |
A bit of a tanget, but if all you want is to get the output into your clipboard so you can paste that into Excel, you can try using something like xclip. Note that you might have to install it. With xclip I can write something like this.
echo -e "xxttyy" | xclip -selection c
It is now in my clipboard I can paste it into Excel. If echo doesn't work you can try printf instead.
If you don't want to type all of that every time you can create an alias instead.
alias xclip="xclip -selection c"
echo -e "xxttyy" | xclip
And if nothing else you can always redirect the output you want to a file and just open it in a text-editor and copy what you need as tabs should stay as tabs in the file.
echo -e "xxttyy" > tmpfile.txt
A bit of a tanget, but if all you want is to get the output into your clipboard so you can paste that into Excel, you can try using something like xclip. Note that you might have to install it. With xclip I can write something like this.
echo -e "xxttyy" | xclip -selection c
It is now in my clipboard I can paste it into Excel. If echo doesn't work you can try printf instead.
If you don't want to type all of that every time you can create an alias instead.
alias xclip="xclip -selection c"
echo -e "xxttyy" | xclip
And if nothing else you can always redirect the output you want to a file and just open it in a text-editor and copy what you need as tabs should stay as tabs in the file.
echo -e "xxttyy" > tmpfile.txt
edited Jan 4 at 23:29
answered Nov 20 '16 at 20:49
ChristerChrister
1335
1335
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f324676%2foutput-tab-character-on-terminal-window%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you please specify your OS and terminal emulator application?
– egmont
Nov 20 '16 at 10:49
xclip may be useful as in printf|xclip
– hildred
Nov 21 '16 at 1:04
In the first version of this question I by mistake wrote
echo -t
where it of course should have beenecho -e
. Some answers & comments below thus took me too literally. Sorry.– Axel Bregnsbo
Nov 26 '16 at 9:59