Questions tagged [ascii]

An acronym of American Standard Code for Information Interchange, a well-known character encoding set.

ASCII is a character encoding standard for electronic communication, where codes represent text in computers, telecommunications equipment, and other devices. Most modern character-encoding schemes are based on ASCII, although they support many additional characters. The "old" ASCII charset is also known as US-ASCII by IANA cause this system was developed in the US and based on the typographical symbols predominantly in use at the time it was created.

External Links:

89 questions
72
votes
9 answers

Bash script to get ASCII values for alphabet

How do I get the ASCII value of the alphabet? For example, 97 for a?
xmpirate
  • 913
  • 2
  • 7
  • 6
67
votes
3 answers

"tree" command output with "pure" (7-bit) ASCII output

The "tree" command uses nice box-drawing characters to show the tree but I want to use the output in a "code-page-neutral" context (I know that really there's always a code page, but by restricting it to the lower characters I hope to be free of…
Tom Goodfellow
  • 867
  • 1
  • 6
  • 7
47
votes
6 answers

ASCII to Binary and Binary to ASCII conversion tools?

Which is a good tool to convert ASCII to binary, and binary to ASCII? I was hoping for something like: $ echo --binary "This is a binary message" 01010100 01101000 01101001 01110011 00100000 01101001 01110011 00100000 01100001 00100000 01100010…
RSFalcon7
  • 4,367
  • 6
  • 30
  • 56
21
votes
3 answers

Difference between EOT and EOF

I understand that EOT is ASCII code 4, whereas EOF is encoded as -1 (at least in C). Before I found out that EOF is mapped to -1, I thought it was just a synonym for EOT. Why is EOF mapped to -1 rather than EOT? As far as I can tell, they both do…
user628544
  • 1,495
  • 2
  • 12
  • 16
21
votes
3 answers

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…
dan
  • 4,007
  • 5
  • 26
  • 34
19
votes
2 answers

Why doesn't the Enter key send EOL?

Unix / Linux EOL is LF, linefeed, ASCII 10, escape sequence \n. Here's a Python snippet to get exactly one keypress: import sys, tty, termios fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ch…
cat
  • 3,428
  • 4
  • 22
  • 50
17
votes
4 answers

Printing decimal to ascii character, my command does not output as intended

I wanted to output a string of all the ascii characters with the following command for i in `seq 32 127`; do printf "%c" $i; done The output of the above command is: 33333334444444444555555555566666666667777777777.............. It's the first…
Ifthikhan
  • 355
  • 2
  • 3
  • 5
17
votes
7 answers

How do I print an ASCII character by different code points in Bash?

In the ASCII table the 'J' character exists which has code points in different numeral systems: Oct Dec Hex Char 112 74 4A J It's possible to print this char by an octal code point by printing printf '\112' or echo $'\112'. How do I…
viavad
  • 333
  • 1
  • 2
  • 8
16
votes
3 answers

Removing all non-ascii characters from a workflow (file)

How would I remove all non-ascii characters from one file? Would there be a specific command to perform this? grep --colour='auto' -P -n'[^\x00-\x7]' /usr/local/... I believe this finds the characters within the workflow, but how would I remove all…
Mizole Ni
  • 169
  • 1
  • 1
  • 9
15
votes
2 answers

Can vim display ASCII characters only, and treat other bytes as binary data?

I already know vim -b, however, depending on the locale used, it displays multi-byte characters (like UTF-8) as single letters. How can I ask vim to only display ASCII printable characters, and treat the rest as binary data, no matter the charset?
Totor
  • 19,302
  • 17
  • 75
  • 102
13
votes
2 answers

Align columns in ASCII file

I have a text file that looks like his: #c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 4599 995,274 2523,658 264,1417170 -33,6000 -0,3600…
Gabriel
  • 1,050
  • 5
  • 15
  • 28
13
votes
1 answer

Why do ^M and \r behave inconsistently?

Perhaps there are already answers out there that indirectly answer my question, but I've read many of them and haven't yet found a satisfactory answer to this discrepancy. The original meaning of carriage return comes from old teleprinters: it meant…
7
votes
6 answers

How do you write specific bytes to a file?

Given a file myfile with the following contents: $ cat myfile foos A hexdump of the file gives us the contents: $ hexdump myfile 6f66 736f 000a Currently, I can create the file by specifying the contents in ascii like this: $ echo foos >…
Cory Klein
  • 18,391
  • 26
  • 81
  • 93
7
votes
3 answers

BASH print question (printf \\$(printf '%03o' $1))

I used the following to convert from int to char and char to int in bash. But I do not understand how printf \\$(printf '%03o' $1) or printf '%d' "'$1" work. Please explain how printf \\$(printf '%03o' $1) and printf '%d' work. #!/bin/bash #…
1885
  • 131
  • 1
  • 4
7
votes
2 answers

Generating file with ASCII numbers using /dev/urandom?

How can I generate 10 MB files from /dev/urandom filled with: ASCII 1s and 0s ASCII numbers between 0 and 9
programings
  • 293
  • 2
  • 10
1
2 3 4 5 6