The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Weird Ascii characters in file names yamsin789 Shell Programming and Scripting 2 10-07-2007 10:27 AM
Multibyte characters to ASCII jerardfjay Shell Programming and Scripting 8 11-18-2005 02:45 AM
Hex characters of ascii file budrito HP-UX 2 08-10-2005 10:26 PM
stupid question about ascii characters jalburger High Level Programming 2 09-28-2004 03:56 PM
Replace string and delete extra characters slaubhan Shell Programming and Scripting 2 08-28-2003 05:49 PM

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

Join Date: Mar 2005
Posts: 2
Replace characters in a string using their ascii value

Hi All,

In the HP Unix that i'm using when i initialise a string as Stalled="'30¬G'"
Stalled=$Stalled" '30¬C'", it is taking the character ¬ as a comma. I need to grep for 30¬G 30¬C in a file and take its count. But since this character ¬ is not being understood, the count returns a zero.
The ascii value of the character ¬ is 188.
I thought of replacing all occurrences of comma using something like
chr(188). But i dont know how to.
Could some one help me or give me some other idea to go about this. I need to do this urgently :-(
Thanks in advance...
  #2 (permalink)  
Old 03-03-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Quote:
Originally Posted by roops
Hi All,

In the HP Unix that i'm using when i initialise a string as Stalled="'30¬G'"
Stalled=$Stalled" '30¬C'", it is taking the character ¬ as a comma. I need to grep for 30¬G 30¬C in a file and take its count. But since this character ¬ is not being understood, the count returns a zero.
The ascii value of the character ¬ is 188.
I thought of replacing all occurrences of comma using something like
chr(188). But i dont know how to.
Could some one help me or give me some other idea to go about this. I need to do this urgently :-(
Thanks in advance...
tr '\188' ',' < file

Last edited by vgersh99; 03-03-2005 at 10:05 AM..
  #3 (permalink)  
Old 03-04-2005
roops roops is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 2
Hi vgersh99

Thank u very much for the pointer u gave. But i cracked this problem using grep itself. I said in 30¬G, let the 3rd character(each record in the file starts with 30¬G or 30¬C ) be anything other than zero (since in the file it is alwz ¬ and never zero.) and the fourth character shud be [GC]. From the grep, i got the count..

Thanks anyways coz i learnt what "tr" command is all about. I'm new to unix and my work revolves around unix. So i'm learning Unix while i'm working on live problems. :-)
Sponsored Links
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 03:49 PM.


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