Sponsored Content
Full Discussion: Ascii to caracter
Top Forums Shell Programming and Scripting Ascii to caracter Post 302169616 by bobbygsk on Thursday 21st of February 2008 05:59:26 PM
Old 02-21-2008
I changed you code little bit to try and I get the following output
Quote:
test=a
valeur=`printf %u "$test"`
char=`expr $valeur + 1`
#printf %c $char "\n"
printf "$char \n"
printf "\\$char \n"
Quote:
98
P
printf "\<ascii number>" gives the ascii character for that value.
The "valeur" is taking the value of 97.
I assumed the value of "A" is 65.
When I run the following command in ksh I get the value of A as 101
Quote:
cat /usr/share/lib/pub/ascii
I have no idea why I'm getting the weird output

Last edited by bobbygsk; 02-21-2008 at 07:09 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

ASCII file

I've been having trouble trying to read an ASCII file. I'm on an IRIX machine, by the way. I've tried "cat" and I get a bunch of unreadable text, and the "string" command gets the "Command not Found" error. Please advise. Thanks. (1 Reply)
Discussion started by: sherbet808
1 Replies

2. UNIX for Dummies Questions & Answers

ascii

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)
Discussion started by: melkor
3 Replies

3. Programming

Extended ascii

Hi all, I would like to change the extended ascii code ( 128 - 255). I tried to change LC_ALL and LANG in current session ( values from locale -a) and for no good. Thanks. (0 Replies)
Discussion started by: avis
0 Replies

4. Shell Programming and Scripting

code ASCII for Caracter -->> '

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)
Discussion started by: ZINGARO
3 Replies

5. Shell Programming and Scripting

binary to ascii

Hi, Is there a way to convert the binary file to ascii . the binary file is pipe delimited. from source the file(pipe delimited) is ftped to mainframe and from mainframe it is ftped to the unix box using binary format. Is there a way to change it back to ascii and view it? Thanks! (3 Replies)
Discussion started by: dnat
3 Replies

6. 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

7. Shell Programming and Scripting

Delete a line last caracter

Hello dears, I have a CVS file in wich a have many lines. each line is ended by this two caracters ';;'. I want to get a new format of this file by deleting this caracters which unix shell script eg. of input file: a;b;c;d;; a;b;c;; a;b;; a;b;c;d;e;; That means each line lenght can... (2 Replies)
Discussion started by: yeclota
2 Replies

8. Programming

Hexadecimal to ascii

Let's suppose i have a hexadecimal array with 16 cells.for example b3e2d5f636111780 i want to convert it to an array of ascii characters(in C) so that i can reduce total size of the file i want to put it in. But i am afraid i have not fully understand the difference between ascii and hex(i... (3 Replies)
Discussion started by: bashuser2
3 Replies

9. Shell Programming and Scripting

bash ascii

hi guys In my bash script I need to use ascii characters such as SYN(22) and US(31). How do I echo them? (3 Replies)
Discussion started by: vlm
3 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
XPRINTF_EXEC(3) 					   BSD Library Functions Manual 					   XPRINTF_EXEC(3)

NAME
asxprintf_exec, dxprintf_exec, fxprintf_exec, sxprintf_exec, xprintf_exec, vasxprintf_exec, vdxprintf_exec, vfxprintf_exec, vsxprintf_exec, vxprintf_exec -- execute-only extensible printf execution SYNOPSIS
#include <printf.h> int asxprintf_exec(char ** restrict ret, printf_comp_t restrict pc, ...); int dxprintf_exec(int fd, printf_comp_t restrict pc, ...); int fxprintf_exec(FILE * restrict stream, printf_comp_t restrict pc, ...); int sxprintf_exec(char * restrict str, size_t size, printf_comp_t restrict pc, ...); int xprintf_exec(printf_comp_t restrict pc, ...); #include <stdarg.h> int vasxprintf_exec(char ** restrict ret, printf_comp_t restrict pc, va_list ap); int vdxprintf_exec(int fd, printf_comp_t restrict pc, va_list ap); int vfxprintf_exec(FILE * restrict stream, printf_comp_t restrict pc, va_list ap); int vsxprintf_exec(char * restrict str, size_t size, printf_comp_t restrict pc, va_list ap); int vxprintf_exec(printf_comp_t restrict pc, va_list ap); DESCRIPTION
These functions are execute-only, extensible printf (see xprintf(5)) variants, taking a printf_comp_t structure created by the format string compilation routine new_printf_comp(3). All these variants behave like their normal printf counterparts (see printf(3)) without 'x' and ``_exec'' in the name (except sxprintf_exec() and vsxprintf_exec() behave like snprintf() and vsnprintf(), respectively). SEE ALSO
printf(3), xprintf_comp(3), xprintf(5) Darwin Aug 19, 2012 Darwin
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy