I am getting a character with a "question mark inside a box". Does anybody know what ascii character i.e. what ascii number would it be. When I copy it in word I get it but when I copy it in notepad it only gives a box. I need to replace that inside my sed command in .SH file so I need to type it and since I cannot find its number anywhere I am unable to type it in notepad.
Unix:
To see the unusual characters in a file in octal (the less unusual characters come out as \x. e.g. Tab is "\t").
Once you know the octal representation you can get the character into an environment variable with unix echo. My echo doesn't have the "-n" switch (no newline).
e.g. For the simple case of a tab character:
We can then use ${TAB} in a sed.
The common characters are listed in unix "man ascii". In your case the character is probably a higher value than those in "man ascii" but this "man" page is a good reference for converting between number bases (octal, decimal, hexadecimal).
Now for M$ Windows:
Once you have the octal value of the character you can convert to decimal (mathematics).
Say if you need to generate the unusual character in Windows Notepad:
Ensure that numlock is on.
Press and hold ALT then type the decimal version of the character on the numeric keyboard.
For example, the Euro Sign (€) is ALT+0128 .
Last edited by methyl; 08-10-2009 at 07:03 PM..
Reason: Various typos and missing tags
A couple of other higher-ascii tricks to add to the excellent suggestions above;
ls -b Converts unprintable (or weirdly printed) characters in filenames into octal
cat -vet Displays a file with all characters displayed (also useful for finding things like carriage returns added to the normal unix line feeds a-la Windows, or page breaks)
<Any suggestion how to create a file where the values are separated by ASCII code 1,with data extracted from a table using shell script The format is :/>
<columnname1(binary1)columnvalue(binary1)columnname2(binary1)columnvalue(binary1)columnname3(binary1)columnvalue... 1st row/>... (6 Replies)
Hi All,
I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting?
Thanks in Advance (2 Replies)
Hello,
With bash-script (ubunto server) I'm trying to read a binary file and, for each character, give back its ascii code (including extended ascii). For example:
HEX => ASCII => PRINT
f5 => 245 => õ
50 => 80 => P
To load the binary file into a variable I tried in this way: ... (2 Replies)
Hello,
When I run this UNIX code without the -t option it gives me the desired results.
The code keeps the record with the greatest datetime based on the key columns.
I sort it first then sort it again with the -u option, that's it.
I need to have a variable to specify an ASCII character... (2 Replies)
Good evening, everybody
A good math friend told me that it would be possible to shrink the size of the numerical datas I produce with a physical simulation code I programmed for my PhD.
It usually writes at least 100 GB to complete the simulation, and it seems that it is too high. There are... (7 Replies)
Hi gurus,
I have a file in unix with ascii values. I need to convert all the ascii values in the file to ascii characters. File contains nearly 20000 records with ascii values. (10 Replies)
I'm a question:
the expresiion 'expr $a +1' use the caracter --> ' (is not shift+ ? !!!)
what is the code ascii for generate this caracter ??????
tank's (3 Replies)
a silly question but is there a way to display individual ascii values
say if i type 65 it will display the letter instead?
thanks fo any help. (3 Replies)