Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anchoring Case options

Status
Not open for further replies.

sumncguy

IS-IT--Management
May 22, 2006
118
US
the (condensed) seed file

11.2[8]SA3
12.0[13]EA1c
12.1[17]
12.2[12b]
12.3[10]
6.4[3]
7.6[2a]
8.3[5]

I want to be able to branch based on the contents of a varable holding an IOS version. How the heck do I anchor the case possibilities to basically say if ver starts with 11, echo 11 code, 12.0 echo 12.0 code etc etc.

I tried "^12.0", "12.0", ^12.0 .. nutting working.

Thanks alot

My cheap code

cat seedfile | cut -d"[" -f1 | while read ver
do
case $ver in
11) echo "I have 11.x IOS code. " ;;
12.0) echo "I have 12.0 IOS code. " ;;
12.1) echo "I have 12.1 IOS code. " ;;
esac
done



 
Code:
sed 's/^\([0-9][0-9]*\).*/I have \1.x IOS code./' seedFile

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
case uses filename expansion semantics, so to match strings beginning with 11 or 12 you would use:

[tt]case $ver in
11*) echo "I have 11.x IOS code" ;;
12*) echo "I have 12.x IOS code" ;;
esac[/tt]

Annihilannic.
 
Thanks to all .... I finally found an old script showing the asteriks. Thanks alot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top