How to insert tabs before output lines from a executed command

Alex Ng

Just a quick question. Is it possible to tab the output on Ubuntu 16.04 LTS? I've created two images below to try and illustrate what I mean by this.

img1

img2

steeldriver

You could do something like this - with file descriptors:

  1. save the current output descriptor so we can restore it later

    exec 3>&1
    
  2. redirect the output stream to a process substitution that inserts the tab - for example

    exec 1> >(paste /dev/null -)
    

From this point, any process that writes to standard output will have that output 'filtered' through the paste command to insert tabs at the start.

  1. When you're done, you can resume normal behavior by restoring the saved file descriptor and closing the temporary one

    exec 1>&3 3>&-
    

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Where is the command lines stored before it is executed?

From Dev

How to insert command output directly into a file before a pattern?

From Dev

How to redirect large amount of output from command executed by CreateProcess?

From Dev

Command to insert lines before first match

From Dev

How to create an array from the lines of a command's output

From Dev

How to create an array from the lines of a command's output

From Dev

Redirection executed before a command

From Dev

How to execute 'clear' bash command before any other command is executed?

From Java

How to do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

From Dev

How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

From Dev

How to see the output of a query which is executed remotely from mysql command line tool?

From Dev

How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

From Dev

bash - count and output lines from command

From Dev

Is there any way to read lines from command output?

From Dev

How to provide two input lines to command executed with Plink

From Dev

How to replace \n and \t with new lines and tabs respectively with one command?

From Dev

How to separate command output to individual lines

From Dev

How to prepend lines to git command output

From Dev

Unable to read output from System Command executed in R

From Dev

How to get PID from remote executed command?

From Dev

How to get PID from remote executed command?

From Dev

How to do an if statement from the result of an executed command

From Dev

at & rm - command executed before pipe

From Dev

How to insert the last output line into the command line?

From Dev

How to insert output of a command at a specific line?

From Dev

Is it possible to save output from a command to a file after the command already has been executed?

From Dev

Is it possible to save output from a command to a file after the command already has been executed?

From Dev

Check for zero lines output from command over SSH

From Dev

Read specific floating point values from lines of the command output

Related Related

  1. 1

    Where is the command lines stored before it is executed?

  2. 2

    How to insert command output directly into a file before a pattern?

  3. 3

    How to redirect large amount of output from command executed by CreateProcess?

  4. 4

    Command to insert lines before first match

  5. 5

    How to create an array from the lines of a command's output

  6. 6

    How to create an array from the lines of a command's output

  7. 7

    Redirection executed before a command

  8. 8

    How to execute 'clear' bash command before any other command is executed?

  9. 9

    How to do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

  10. 10

    How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

  11. 11

    How to see the output of a query which is executed remotely from mysql command line tool?

  12. 12

    How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

  13. 13

    bash - count and output lines from command

  14. 14

    Is there any way to read lines from command output?

  15. 15

    How to provide two input lines to command executed with Plink

  16. 16

    How to replace \n and \t with new lines and tabs respectively with one command?

  17. 17

    How to separate command output to individual lines

  18. 18

    How to prepend lines to git command output

  19. 19

    Unable to read output from System Command executed in R

  20. 20

    How to get PID from remote executed command?

  21. 21

    How to get PID from remote executed command?

  22. 22

    How to do an if statement from the result of an executed command

  23. 23

    at & rm - command executed before pipe

  24. 24

    How to insert the last output line into the command line?

  25. 25

    How to insert output of a command at a specific line?

  26. 26

    Is it possible to save output from a command to a file after the command already has been executed?

  27. 27

    Is it possible to save output from a command to a file after the command already has been executed?

  28. 28

    Check for zero lines output from command over SSH

  29. 29

    Read specific floating point values from lines of the command output

HotTag

Archive