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.

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 05-28-2007
rinku rinku is offline
Registered User
  
 

Join Date: May 2007
Posts: 54
Question help me

how can I print A to Z using for loop or If condition.
Exmp:
I have one file name 098A. I run one script which check that file name
Now every time one script run the file name(098A) will change and it will look like 098B then 098C.... the atlast 098Z.
please help me.
  #2 (permalink)  
Old 05-28-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,953
Code:
awk '{ for(i=65; i<=90; i++) { printf "%c\n", i }; exit }' /bin/ls
  #3 (permalink)  
Old 05-28-2007
rinku rinku is offline
Registered User
  
 

Join Date: May 2007
Posts: 54
Unhappy thanx...

Thanx..
If I want to store The value of "%c" in one variable without print this then what is the command. please tell me as earli as possible.
  #4 (permalink)  
Old 05-28-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,953
Quote:
please tell me as earli as possible.
This is not encouraged.

Looking for something like this,

Just to store,
Code:
awk '{ for(i=65; i<=90; i++) {  arr[i]=i } }' /bin/ls
To store and display
Code:
awk '{ for(i=65; i<=90; i++) {  arr[i]=i } }END{ for ( i in arr ) { printf "%d %c\n", i, arr[i] } }' /bin/ls
  #5 (permalink)  
Old 05-28-2007
rinku rinku is offline
Registered User
  
 

Join Date: May 2007
Posts: 54
awk '{ for(i=65; i<=90; i++) { arr[i]=i } }END{ for ( i in arr ) { printf "%d %c\n", i, arr[i] } }' /bin/ls


output of this is::::
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
90 Z
65 A
66 B
67 C
68 D
69 E
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y


Why it is not giving in proper way. can I get A to Z serially.
  #6 (permalink)  
Old 05-28-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,953
Code:
awk '{ for(i=65; i<=90; i++) { arr[i]=i } }END{ for ( i in arr ) { printf "%d %c\n", i, arr[i] } }' /bin/ls | sort -k1
Closed Thread

Bookmarks

« Loop | cron help »
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 12:23 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