![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looping and using Sed | digobh | Shell Programming and Scripting | 4 | 02-04-2008 05:25 PM |
| looping search question | alfredo123 | Shell Programming and Scripting | 3 | 11-16-2006 12:39 AM |
| Perl question - looping through an array of hashrefs | kregh99 | Shell Programming and Scripting | 2 | 03-19-2004 07:48 AM |
| nested looping question | Sn33R | Shell Programming and Scripting | 7 | 09-26-2003 11:14 AM |
| looping question | hedrict | UNIX for Dummies Questions & Answers | 1 | 03-11-2002 01:19 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have series of data stored in a variable xyz: (between 0 and 100) example: 20 45 98 21..... I need to find if there is/are any occurance of data > 95 Not sure what kind of looping is required to check. Please help. thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Using ksh and, if I'm reading your question correctly, xyz="20 45 98 21" simply
Code:
for N in $xyz
do
if [ $N -gt 95 ]
then
echo "$N is greater than 95"
fi
done
Code:
I=0
for N in $xyz
do
if [ $N -gt 95 ]
then
echo "$N is greater than 95 and is element $I"
fi
(( I = I + 1 ))
done
|
|
#3
|
|||
|
|||
|
Thank you Hegemaro.
It worked like a charm. |
|||
| Google The UNIX and Linux Forums |