Output tab character on terminal window












5














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.










share|improve this question
























  • 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 been echo -e. Some answers & comments below thus took me too literally. Sorry.
    – Axel Bregnsbo
    Nov 26 '16 at 9:59
















5














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.










share|improve this question
























  • 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 been echo -e. Some answers & comments below thus took me too literally. Sorry.
    – Axel Bregnsbo
    Nov 26 '16 at 9:59














5












5








5







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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '16 at 9:56

























asked Nov 20 '16 at 10:31









Axel 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 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


















  • 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 been echo -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










3 Answers
3






active

oldest

votes


















7














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.






share|improve this answer





















  • 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





















3














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?






share|improve this answer























  • 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



















2














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





share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    7














    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.






    share|improve this answer





















    • 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


















    7














    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.






    share|improve this answer





















    • 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
















    7












    7








    7






    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.






    share|improve this answer












    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.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 20 '16 at 10:48









    egmont

    2,5711912




    2,5711912












    • 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










    • 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















    3














    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?






    share|improve this answer























    • 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
















    3














    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?






    share|improve this answer























    • 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














    3












    3








    3






    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?






    share|improve this answer














    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?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 13 '17 at 12:36









    Community

    1




    1










    answered Nov 20 '16 at 10:39









    Thomas Dickey

    52.1k594164




    52.1k594164












    • 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


















    • 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
















    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











    2














    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





    share|improve this answer




























      2














      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





      share|improve this answer


























        2












        2








        2






        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





        share|improve this answer














        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






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 days ago

























        answered Nov 20 '16 at 20:49









        Christer

        1335




        1335






























            draft saved

            draft discarded




















































            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀