Visit Our UNIX and Linux User Community


Decimal value for special character


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Decimal value for special character
# 1  
Old 06-03-2011
Decimal value for special character

I am seeing an special character in my file
when i do the

Code:
 
cat filename | od-bc


I see a value of 376 for that special character.
I would like to find the decimal value for the character.

For example the decimal value for ctrl-Y is char(25).
Appreciate help on this.
# 2  
Old 06-03-2011
Quote:
Originally Posted by pinnacle
I am seeing an special character in my file
when i do the

Code:
 
cat filename | od-bc


I see a value of 376 for that special character.
I would like to find the decimal value for the character.

For example the decimal value for ctrl-Y is char(25).
Appreciate help on this.

Code:
 
Ÿ

# 3  
Old 06-03-2011
Quote:
Originally Posted by getmmg
Code:
 
Ÿ


Sorry i think i did not make my question clear.

I want the command to look for the decimal value of any character in file.
# 4  
Old 06-03-2011
It is decimal 254.

Read the od man page for further information about the various output formats.
# 5  
Old 06-03-2011
Quote:
Originally Posted by fpmurphy
It is decimal 254.

Read the od man page for further information about the various output formats.
I know the values for
Quote:
characters
A,B,C,D
in decimal are
65,66,67,68
I am tring to achieve this in unix but could not get.

I tried various commands after reading man page.
some of them are:
Code:
 

UnixServer:/home/user $ echo "A" | od -s
0000000   16650
0000002
UnixServer:/home/user $ echo "A" | od -i
0000000   16650
0000002
UnixServer:/home/user $ echo "A" | od -L
0000000   1091174400
0000002
UnixServer:/home/user $ echo "A" | od -d
0000000  16650
0000002
UnixServer:/home/user $ echo "A" | od -D
0000000  1091174400
0000002

Help is appreciated for the command to convert to decimal.
# 6  
Old 06-03-2011
var="a";printf "%d", "${var}"
# 7  
Old 06-03-2011
Code:
 
perl -le 'print chr(376)'


Previous Thread | Next Thread
Test Your Knowledge in Computers #833
Difficulty: Medium
YAML version 1.2 is a superset of JSON.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Special character $$

Hi, on ksh What does the following do? grep -v "toolbox" $home_oracle/.profile >$home_oracle/.profile.$$ Thanks. Please use CODE tags as required by forum rules! (3 Replies)
Discussion started by: big123456
3 Replies

2. Shell Programming and Scripting

^M special character in Filename

Hi All, Special character ? is added in between filename. Am not able to figure our why this is happening. In my Development environment special characters are not present. This issue is happening in the higher environment. It would be helpful if somebody can tell what are the possible... (3 Replies)
Discussion started by: weknowd
3 Replies

3. Shell Programming and Scripting

Use decimal value of array in bc ends with illegal character

hi all I have to read a long cvs file every 4 columns with decimal "3,45" numbers. The 9th row in this cvs is the first line I need, so it I tail -n+9. I use sed -e 's/,/./g' to get decimal values with . delimiter. So far no problem. Goal is to get two maximum negative forces in ranges... (5 Replies)
Discussion started by: Grille
5 Replies

4. Shell Programming and Scripting

Vi special character

When editing a file, vi displays a special character as ^L. Can you tell me the escaped character to be used in awk? And can that escaped character be used in a regexp in both sed and awk? (7 Replies)
Discussion started by: dmesserly
7 Replies

5. Shell Programming and Scripting

need help in expanding hexa decimal character range

Hi all, I have a input like this 3AF9:3B01 and need to expand to the below output 3AF9 3AFA 3AFB 3AFC 3AFD 3AFE 3AFF 3B00 3B01 Please let me know the easiest way for achieving this. Thanks for the help in advance... (6 Replies)
Discussion started by: leo.maveriick
6 Replies

6. Shell Programming and Scripting

Deleteing one character after an special character

I have below line in a unix file, I want to delete one character after "". 20091020.Non-Agency CMO Daily Trade Recap ~V Hybrids The result should be : 20091020.Non-Agency CMO Daily Trade Recap Hybrids i dont want to use "~V" anywhere in the sed command or any other command, just remove... (1 Reply)
Discussion started by: mohsin.quazi
1 Replies

7. Shell Programming and Scripting

Special character \

Hi, In the shell script, i need to remove the special charater "\" with "\\". For example, i need to replace "D:\FXT\ABC.TXT" with "D:\\FXT\\ABC.TXT". However, when trying to do something like , i get the below error :- -->echo "D:\FXT\ABC.TXT" | sed -e 's#\#\\#g' sed: 0602-404 Function... (7 Replies)
Discussion started by: amit_arora
7 Replies

8. Shell Programming and Scripting

special character

Hi, I am trying to unload file from a database. Which contains few lines with the character below. Rest of the data was unloaded appropriately. a) What does this below character means? b) How can i remove it, I already have sed '/^$/d' c) Will this effect the file by any means... (4 Replies)
Discussion started by: tostay2003
4 Replies

9. Shell Programming and Scripting

How To Make Decimal Point Fall On The 15th Character On The Screen

If i have a variable which is a decimal number, i.e 34.05 How can you make decimal point fall on the 15th character on the screen? Or any other that you can specify? Can you do it using sed or awk? (3 Replies)
Discussion started by: Vozx
3 Replies

10. Programming

special character ?

hey there im a bit stuck on executing commands that include the special character '?'. can someone recommend a way on how i would be able to execute it?? i thought the glob function could be useful (still mite be) but upon entering the command 'ls pars?' it listed all the files in the... (1 Reply)
Discussion started by: mile1982
1 Replies

Featured Tech Videos