News for hackers. Stuff that matters.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by thwarted on Wednesday March 26, 2014 @02:38PM (#7475401)
Unit Separator is Control-_ (underscore) and Record Separator is Control-^ (caret), for instance.

Most modern text editors won't pass through every control character. Vim lets me type the unit separator, but not the record separator, for instance.

Vim has bindings for some control key combos, which is why you can't type them directly. I can type control-_ without issue, but to get an ASCII 30 (RS) to show up, I have to type control-v first (just like when at the shell prompt).

Useful hint: if you look at the output of man ascii (at least on linux with man-pages-3.22) find the control character you want to type in the left column and look in the same row on in the right column to find the letter/key to use with the control key.

For example, to type NAK, it's <control-u>. Vertical tab is <control-k>:

   $ echo <control-v><control-k> | od -c
   0000000  \v  \n
This is useful for control characters that don't have backslash escape expansions.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by raldi on Wednesday March 26, 2014 @02:44PM (#7475457)
...and that's why, when running a command that's reading what you're typing to stdin, you press Ctrl-D to tell it that you're done. Because, as your "man ascii" trick shows, this generates the "end of transmission" character.

Similarly, Ctrl-L clears the screen in most Unix apps because that generates the "form feed" character, and on a line printer or paper-based teletype terminal, "form feed" means to advance to the next page -- a nice empty clear piece of paper.

Re:ASCII Delimited Text – Not CSV or TAB delimited text by thwarted on Wednesday March 26, 2014 @04:13PM (#7476259)
when running a command that's reading what you're typing to stdin, you press Ctrl-D to tell it that you're done. Because, as your "man ascii" trick shows, this generates the "end of transmission" character.

This is slightly different than being able to actually generate those characters as input. If you put a control-d in a file, nothing will stop reading the file when it sees the control-d, it's just another byte. readline knows how to interpret a bunch of control characters. There's also the terminal driver that has interpretations, which you can see with `stty -a`. When the tty layer sees a control-d or a control-c, it closes stdin or generates SIGINT, respectively. But even this can be dependent on if you're on a pty or attached directly to a serial line. There's nothing special about the mapping of control-d to end-of-transmission character, that's just how the layer that sees it is interpreting it. You can, for example, change how control-c is interpreted by `stty intr ^B`, which will make control-b generate SIGINT. And there's a way to put the terminal driver in complete transparent/passthru mode.

Re:ASCII Delimited Text – Not CSV or TAB delimited text by raldi on Wednesday March 26, 2014 @04:55PM (#7476592)
Sure, the default is overridable, and the character has no magic effect when found in a binary file, but there's a reason Ctrl-D was chosen as the standard keystroke sequence to end a stdin transaction, and it has everything to do with the fact that "D" shows up next to "end of transmission" in `man ascii`.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by thwarted on Wednesday March 26, 2014 @10:57PM (#7478297)
Thank you for clarifying something that no one was disputing or event mentioned.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by qu4z-2 on Wednesday March 26, 2014 @11:44PM (#7478470)
Yeah, I hate it when people point out interesting things I didn't know before too.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by thwarted on Thursday March 27, 2014 @03:21AM (#7479046)
I'm sure raldi can repeat, again, making it 3 times, that control-d means end of transmission and that's why it was chosen for signalling end of stdin, on a thread about how to type the control characters.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by oneeyedpigeon on Wednesday March 26, 2014 @09:14PM (#7477900)
I am going to love not having to type out 'clear' all the time - thank you!
Re:ASCII Delimited Text – Not CSV or TAB delimited text by sopooneo on Wednesday March 26, 2014 @03:33PM (#7475887)
what about Ctrl-C to break out of stuff? Does that correspond to an ascii control character?
Re:ASCII Delimited Text – Not CSV or TAB delimited text by elwin on Wednesday March 26, 2014 @04:06PM (#7476203)
Ctrl-C stops the program because the TTY driver watches for it and sends an interrupt signal when it appears. It's a slightly different mechanism.

There are more details in "man 3 termios", but be warned, the TTY layer is not a pleasant subject for reading.

Re:ASCII Delimited Text – Not CSV or TAB delimited text by danielweber on Wednesday March 26, 2014 @04:52PM (#7476566)
I was disappointed that Ctrl-S and Ctrl-Q don't correspond (at least on the first ASCII chart I googled) to anything, because Ctrl-S stops text on my Unix terminals the exact same way it did on my brother's Apple ][e in 1984.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by jrochkind1 on Wednesday March 26, 2014 @05:13PM (#7476715)
> I was disappointed that Ctrl-S and Ctrl-Q don't correspond (at least on the first ASCII chart I googled) to anything

I'm pretty sure every possible combination of 7-bits is assigned SOME name in ascii, and Ctrl-any-case-insensitive-letter is a defined 7bit value.

This chart says control-s is `DC3 (Device Control, X-OFF)` and control-q is `DC1 (Device Control, X-ON)`. Yup, that's what they do alright.

http://www.unix-manuals.com/refs/misc/ascii-table.html

Don't forget everyone's favorite control-G, BEL, useful sending beeps across the wire on old school IRC, BBSen, and chat services. Or, you know, telegraph machines or something.

Re:ASCII Delimited Text – Not CSV or TAB delimited text by csixty4 on Wednesday March 26, 2014 @05:40PM (#7476866)
For anyone wondering, X-ON and X-OFF are flow control characters. A device sends X-OFF to say "my buffer is full, stop sending data" and X-ON when it's ready to resume.

On most Unix terminals, these have the effect of pausing and resuming the display when a bunch of data is scrolling by.

Re:ASCII Delimited Text – Not CSV or TAB delimited text by __del__ on Wednesday March 26, 2014 @07:03PM (#7477301)
...and they're helpfully disabled with stty -ixon
Re:ASCII Delimited Text – Not CSV or TAB delimited text by danielweber on Wednesday March 26, 2014 @07:19PM (#7477390)
Oh, thank you. The reference I found[1] only showed them as "device control." I thought I imagined them having that.

Also, the classic control-G is still in C. "\a" is "alert (beep)."

[1] http://www.asciitable.com/

Re:ASCII Delimited Text – Not CSV or TAB delimited text by fineline on Wednesday March 26, 2014 @06:57PM (#7477260)
I think you mean your brother's Apple //e - they switched from the original ][ to // for later models. That's what I started programming on too - except in my case it was my Dad's.
Re:ASCII Delimited Text – Not CSV or TAB delimited text by danielweber on Wednesday March 26, 2014 @07:20PM (#7477401)
Ah, but the boot screen said "APPLE ]["
Re:ASCII Delimited Text – Not CSV or TAB delimited text by jloughry on Wednesday March 26, 2014 @04:19PM (#7476296)
Ctrl-C was originally "End of Text".
Re:ASCII Delimited Text – Not CSV or TAB delimited text by dhimes on Wednesday March 26, 2014 @06:10PM (#7477010)
That's a terrific hint. So the ctrl-<dec-val + 64 char> = <dec val char>