The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to remove a character which is enclosed in Double quotes mohan_tuty UNIX for Advanced & Expert Users 3 06-16-2008 12:55 PM
charecter or number ganapati UNIX for Dummies Questions & Answers 1 01-02-2008 08:44 AM
Comapring files charecter by charecter using AWK/Shell Script evvander Shell Programming and Scripting 1 09-12-2007 06:44 AM
cut First charecter in any string rinku Shell Programming and Scripting 6 05-29-2007 08:23 AM
cutting columns if delimiter has more than one charecter mahabunta UNIX for Dummies Questions & Answers 9 09-14-2006 09:23 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-20-2007
rinku rinku is offline
Registered User
  
 

Join Date: May 2007
Posts: 54
find charecter from its ascii value.

how could find charecter from its ascii value.
please suggest me any code for that.
thannks in advance.
  #2 (permalink)  
Old 11-20-2007
eggi eggi is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 3
You can use perl's pack function to do that

$hex_ascii=%20;
print "HEX $hex_ascii\n";
$hex_ascii =~ s/%(..)/pack("c",hex($1))/ge;
print "Alpha $hex_ascii\n";

Code above may not suit exactly what you're looking for, but hopefully points in the right direction

, Mike
  #3 (permalink)  
Old 11-20-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
You can convert back and forth in a shell script with printf and od. For example a lower case "a" = octal 141...

Code:
$ printf a | od -An -to1
         141
$ printf "\141 \n"
a
$

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0