If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > grep problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-04, 16:58
estumator estumator is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
grep problem

Hi,I want to match a string which begins with a capital letter and followed by any number of characters in alphabate, in which case I used
"grep -E '^[A-Z][A-Za-z]+$'" as regular expression, but the "+" doesn't seem to work............somehow
Reply With Quote
  #2 (permalink)  
Old 02-25-04, 17:34
estumator estumator is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
Another problem:
grep: Trailing backslash

mup: line 24: [: !=: unary operator expected
Reply With Quote
  #3 (permalink)  
Old 02-26-04, 01:52
aigles aigles is offline
Registered User
 
Join Date: Jan 2004
Location: Bordeaux, France
Posts: 319
Re: grep problem

Quote:
Originally posted by estumator
Hi,I want to match a string which begins with a capital letter and followed by any number of characters in alphabate, in which case I used
"grep -E '^[A-Z][A-Za-z]+$'" as regular expression, but the "+" doesn't seem to work............somehow
If any number of characters in alphabate can follow the first one, '+' is not the right operator
'+' is for 'or or more'
'*' is for any

try:
Code:
grep -E '^[A-Z][A-Za-z]*$'
Quote:
Originally posted by estumator Another problem:
grep: Trailing backslash
mup: line 24: [: !=: unary operator expected
What is the grep command ?
It seems that your grep is inside an 'if' statement ([ !=), if true give us also the 'if' statement.
__________________
Jean-Pierre.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On