UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 8th, 2005, 06:38 AM
BlueCrush BlueCrush is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 3 BlueCrush User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 31 sec
Reputation Power: 0
Can't work out a pattern that will match a certain string!

I'm trying to do a case statement, where one of the patterns must identify any parameters which don't have a '.' (dot in them),
i.e., if my list of variable were

red.txt blue.txt yellow.txt green

I would need the pattern to identify the 'green' one, as this doesn't have a . in it.
I've been trying patterns along the line of this:

*'.'*)

but this identifies every variable name, with or without a dot in it. Been trying to do this for days now!!
Thanks very much for any help.
Jess

Reply With Quote
  #2  
Old April 12th, 2005, 05:35 AM
zlutovsky zlutovsky is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Prague, Czech Rep.
Posts: 116 zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 34 sec
Reputation Power: 6
Quote:
Originally Posted by BlueCrush
I'm trying to do a case statement, where one of the patterns must identify any parameters which don't have a '.' (dot in them),
i.e., if my list of variable were

red.txt blue.txt yellow.txt green

I would need the pattern to identify the 'green' one, as this doesn't have a . in it.
I've been trying patterns along the line of this:

*'.'*)

but this identifies every variable name, with or without a dot in it. Been trying to do this for days now!!
Thanks very much for any help.
Jess



Hello,

perhaps I do not understand properly what you mean. On HP-UX under Bourne shell the simple pattern *.* does the yob:

:
while read P ; do
case $P in
*.*) echo "here is a dot:" $P;;
*) echo "without a dot:" $P;;
esac
done <<!
red.txt
blue.txt
yellow.txt
green
!

Try it

Reply With Quote
  #3  
Old April 14th, 2005, 06:57 AM
BlueCrush BlueCrush is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 3 BlueCrush User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 31 sec
Reputation Power: 0
Smile Thanks!

[QUOTE=zlutovsky]

case $P in
*.*) echo "here is a dot:" $P;;
*) echo "without a dot:" $P;;
esac
QUOTE]

That was what I needed! I needed put this in a case statement of its own so I could use the 'anything else' option!
Thanks v much! Your help is much appreciated!

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Can't work out a pattern that will match a certain string!


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway