Skip to main content
Tweeted twitter.com/#!/StackUnix/status/463426502541852672
deleted 18 characters in body
Source Link
dan
  • 4.1k
  • 5
  • 29
  • 35

The unit separator ASCII character (ASCII 31, octal 37), is visible in Vim as a ^_. But if I print the same file to the terminal, the character is invisible. This causes the fields on a line to get stuck together:

# In Vim and less: first field^_second field^_last field # cat the same file to terminal: cat delim.txt first fieldsecond fieldlast field # print 2nd field with awk cat delim.txt | awk 'BEGIN {FS = "\037"} {print $2}' second field 

I suppose I can make the unit separator visible with this tr commandcat -v:

cat -v delim.txt | tr '\037' ':' first field:secondfield^_second field:lastfield^_last field 

But this is rather cumbersome. Why doesn't the unit separator have a visible representation when printed to stdout in the Bash shell? I can't even copy and paste the shell output correctly; the unit separator gets lost in the process.

The unit separator ASCII character (ASCII 31, octal 37), is visible in Vim as a ^_. But if I print the same file to the terminal, the character is invisible. This causes the fields on a line to get stuck together:

# In Vim and less: first field^_second field^_last field # cat the same file to terminal: cat delim.txt first fieldsecond fieldlast field # print 2nd field with awk cat delim.txt | awk 'BEGIN {FS = "\037"} {print $2}' second field 

I suppose I can make the unit separator visible with this tr command:

cat delim.txt | tr '\037' ':' first field:second field:last field 

But this is rather cumbersome. Why doesn't the unit separator have a visible representation when printed to stdout in the Bash shell?

The unit separator ASCII character (ASCII 31, octal 37), is visible in Vim as a ^_. But if I print the same file to the terminal, the character is invisible. This causes the fields on a line to get stuck together:

# In Vim and less: first field^_second field^_last field # cat the same file to terminal: cat delim.txt first fieldsecond fieldlast field # print 2nd field with awk cat delim.txt | awk 'BEGIN {FS = "\037"} {print $2}' second field 

I suppose I can make the unit separator visible with cat -v:

cat -v delim.txt first field^_second field^_last field 

But this is rather cumbersome. Why doesn't the unit separator have a visible representation when printed to stdout in the Bash shell? I can't even copy and paste the shell output correctly; the unit separator gets lost in the process.

Source Link
dan
  • 4.1k
  • 5
  • 29
  • 35

Why is the unit separator (ASCII 31) invisible in terminal output?

The unit separator ASCII character (ASCII 31, octal 37), is visible in Vim as a ^_. But if I print the same file to the terminal, the character is invisible. This causes the fields on a line to get stuck together:

# In Vim and less: first field^_second field^_last field # cat the same file to terminal: cat delim.txt first fieldsecond fieldlast field # print 2nd field with awk cat delim.txt | awk 'BEGIN {FS = "\037"} {print $2}' second field 

I suppose I can make the unit separator visible with this tr command:

cat delim.txt | tr '\037' ':' first field:second field:last field 

But this is rather cumbersome. Why doesn't the unit separator have a visible representation when printed to stdout in the Bash shell?