Sponsored Content
Full Discussion: Incrementing ascii values
Top Forums Shell Programming and Scripting Incrementing ascii values Post 302497588 by alister on Thursday 17th of February 2011 03:53:38 PM
Old 02-17-2011
Quote:
Originally Posted by apmcd47
Like this?
Code:
echo This is Something z write home aboutZ | tr 'a-zA-Z' 'b-zA-Za'
Uijt jt Tpnfuijoh A xsjuf ipnf bcpvua

Andrew
Depending on the locale settings, this may or may not do what you expect. For example, in an en_US.UTF-8 locale, a-z expands to aBbCc...YyZz. a-z and A-Z are almost identical in such a locale; a-z covers all letters except for "A", and A-Z covers all letters except for "z".

It's a good idea to explicitly set the applicable locale environment variables in the script when using range expressions.

Regards,
Alister

P.S. While helping to troubleshoot a script a while back, this particular "feature" claimed an hour of my life. NEVER AGAIN! Smilie

Last edited by alister; 02-17-2011 at 05:02 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep using ASCII values

machine: HPUX file: a.dat contents: decimal 1 decimal 2 string 1 string 2 ASCII value of 'd': 100. to grep lines that have 'd', I use the following command grep d a.dat My requirement: I should grep for lines that contain 'd'. But I should use ASCII value of 'd' in the command... (1 Reply)
Discussion started by: sriksama
1 Replies

2. UNIX for Advanced & Expert Users

Converting Binary decimal coded values to Ascii Values

Hi All, Is there any command which can convert binary decimal coded values to ascii values... i have bcd values like below оооооооооооо0о-- -v - Pls suggest a way to convert this. Thanks, Deepti.Gaur (3 Replies)
Discussion started by: gaur.deepti
3 Replies

3. Post Here to Contact Site Administrators and Moderators

No. post not incrementing

Hi Admin, i just noticed that when I do postings, the number does not increment. eg : Post A -Total Posts 312 Post B - Total Posts 312 Post C - Total Posts 313 Post D - Total Posts 313 Why is this so? Can you kindly check this out? Thank you. (5 Replies)
Discussion started by: incredible
5 Replies

4. Shell Programming and Scripting

convert ascii values into ascii characters

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)
Discussion started by: sandeeppvk
10 Replies

5. Shell Programming and Scripting

Unix c-shell - replacing/incrementing values in columns?

2 21 1 12 3 123 4 1234 6 49 0 49 33 212 I need to replace/increment all the values in the 2nd column that correspond to 0 in the first column. so for 0 49 i would get 0 50 this can be done through: paste num4.txt... (14 Replies)
Discussion started by: audrey_flox
14 Replies

6. Shell Programming and Scripting

Auto incrementing a particular column values

Hi All, I have the input file(.csv) like below. SNo,Step,Data 1,0,1 2,0,2 3,1,1 4,2,2 5,0,3 6,0,4 and I need the following output. 1,0,1 2,0,2 3,1,1 4,2,2 5,3,3 6,3,4 (5 Replies)
Discussion started by: ks_reddy
5 Replies

7. Shell Programming and Scripting

Anagram finder based in Ascii values

Hello, i need some help with a programm i want to make, what i want to do is to make a dictionary and include some anagrams with it, and make the programm read the Ascii value of each word, and compare them with the anagrams and make the programm print the words that have the same Ascii value,... (1 Reply)
Discussion started by: jose2802
1 Replies

8. UNIX for Beginners Questions & Answers

Convert ascii character values to number that comes between the numbers in UNIX

I have variable that contains multiple values of number and also include overpunch(i.e. # $ % etc) character so we want to replace it with numbers. here are the example: Code: 11500#.0# 28575$.5$ 527#.7# 42".2" 2794 .4 2279!.9! 1067&.7& 926#.6# 2279!.9! 885".5" 11714$.4$ 27361'.1'... (1 Reply)
Discussion started by: nadeemrafikhan
1 Replies

9. Shell Programming and Scripting

Replace alphabets in a string with their ASCII values

hi. I have a requirement where I need to REPLACE all alphabets from an alphanumeric input string into their respective ASCII decimal value. For example: If the input string is ABAC123, the output should be 65666567123 I am seeking a single line command, and I was trying searching for options... (21 Replies)
Discussion started by: kumarjt
21 Replies

10. Shell Programming and Scripting

Convert Hex to Ascii in a Ascii file

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)
Discussion started by: HemaV
2 Replies
CTYPE(3)						     Library Functions Manual							  CTYPE(3)

NAME
isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii, toupper, tolower, toascii - character classification macros SYNOPSIS
#include <ctype.h> isalpha(c) . . . DESCRIPTION
These macros classify ASCII-coded integer values by table lookup. Each is a predicate returning nonzero for true, zero for false. Isascii and toascii are defined on all integer values; the rest are defined only where isascii is true and on the single non-ASCII value EOF (see stdio(3S)). isalpha c is a letter isupper c is an upper case letter islower c is a lower case letter isdigit c is a digit isxdigit c is a hex digit isalnum c is an alphanumeric character isspace c is a space, tab, carriage return, newline, vertical tab, or formfeed ispunct c is a punctuation character (neither control nor alphanumeric) isprint c is a printing character, code 040(8) (space) through 0176 (tilde) isgraph c is a printing character, similar to isprint except false for space. iscntrl c is a delete character(0177) or ordinary control character (less than 040). isascii c is an ASCII character, code less than 0200 tolower c is converted to lower case. Return value is undefined if not isupper(c). toupper c is converted to upper case. Return value is undefined if not islower(c). toascii c is converted to be a valid ascii character. SEE ALSO
ascii(7) 7th Edition May 12, 1986 CTYPE(3)
All times are GMT -4. The time now is 09:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy