amon
1
I was wondering can anyone give me a clue how to start script which would do the following:
I have 2 numbers as input for example: 100 and 1000 and I need to create file and in that file should be written
100 - 199
200 - 299
300 - 399
400 - 499
500 - 599
600 - 699
700 - 799
800 - 899
900 - 999
U can guess if I have 100 as a number and 100 000 as b number how would it like...
should I start with awk or...
thanks in advance...
Input 1- 100
Input 2 -1000
hope thats what u wanna do....
#! /bin/ksh
typeset -i ranger=$1
typeset -i mark=$2
typeset -i range=`expr $ranger - 1`
while [[ $ranger -lt $mark ]]
do
echo "$ranger "-" `expr $ranger + $range`"
ranger=`expr $ranger + $range`
ranger=`expr $ranger + 1`
done
#! /usr/bin/ksh
if [ $# -ne 2 ]
then
echo "<script> first second"
exit 1
fi
first=$1
second=$2
INTERVAL=$1
while [ $first -lt $second ]
do
echo "$first---$(($first + $INTERVAL - 1))"
first=$(($first + $INTERVAL))
done
exit 0
amon
4
Thank to both of U...I am beginner in shell programming but I figure how scripts work...
THANKS again