LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-19-2014, 02:32 PM   #16
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Original Poster
Rep: Reputation: Disabled
Smile Got it!


It took a while but thanks you all of you I got it.
Code:
#!/bin/bash
j=1
LEFT="http://xxx.xxxxx.xxx/languages-pronunciations/de/alphabetically/"
HEX="\x"
NUM=65
while [ $j -le 10 ]; do
printf %x $NUM | cat > hexnum
hexnum=`cat hexnum`
LETTER=$HEX$hexnum
echo "Num= " $NUM " " $hexnum
echo -e "$LETTER" | cat
RIGHT="/page-1/"
URL="$LEFT$LETTER$RIGHT"
echo -e "$URL" | cat > url.txt
i=`cat url.txt`
echo $i
((NUM++))
((j++))
done
Here's the output
Code:
~$ test4
Num=  65   41
A
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/A/page-1/
Num=  66   42
B
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/B/page-1/
Num=  67   43
C
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/C/page-1/
Num=  68   44
D
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/D/page-1/
Num=  69   45
E
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/E/page-1/
Num=  70   46
F
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/F/page-1/
Num=  71   47
G
http://www.xxxx.xxx/languages-pronunciations/de/alphabetically/G/page-1/
Num=  72   48
H
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/H/page-1/
Num=  73   49
I
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/I/page-1/
Num=  74   4a
J
http://www.xxxxx.xxx/languages-pronunciations/de/alphabetically/J/page-1/
There's extra code and output that is there just for debugging purposes. It will be removed in the final version. I just did a run of 10 url's but it will now do what I want; they way I want.
Thanks to all for your kind assistance.
jdk
 
Old 06-15-2018, 02:38 PM   #17
pysatdp
LQ Newbie
 
Registered: Jun 2018
Posts: 1

Rep: Reputation: Disabled
Smile X001 need to increment in shell script

Hello there,
I am a newbie to this forum.

I would like to get some help here. I have .ksh script and my script will read from a configuration table to echo the value. The configuration table will have one value such as X001, and the expectation from me is to return incremental values such as X001, X002, X003, X004, X005, X006 etc. how could I achieve this in my .ksh script? Any help please?

for example:

cat ${DataDir}/file.txt | while read a ;
do
echo "seq_num :$a";
#### I need to return incremental value for the seq_num because there are more than 1 file that gets generated later
#### and I need to add the incremental seq_num to each of those files that gets generated.
export SEQ_NUM=$a
done
 
Old 06-15-2018, 03:30 PM   #18
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
First, you should open a new thread instead of activating a 4-year old one.
Second, please show us what you have tried, and why it's not working for you.
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Increment in bash graphicsmanx1 Programming 18 11-23-2012 10:23 PM
[SOLVED] Bash Script to increment eyanu Linux - Newbie 2 11-16-2012 05:10 AM
[Bash] increment number in a string czezz Programming 4 07-01-2009 11:34 AM
bash equivalent to C increment operator andrewb758 Linux - General 5 02-21-2009 12:25 PM
Checking whether a variable is alphabetic basildon Linux - Newbie 4 09-21-2008 04:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration