Posix string to match [[0-999]]


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Posix string to match [[0-999]]
# 8  
Old 10-15-2005
Yes, you got it. The I reason for posting that reply was to encourage you to understand exactly what the regular expression means, which you obviously have done.
# 9  
Old 10-15-2005
Thanks very much

Thanks very much for encouraging my understanding - can you tell me if I have to enclose things in quotes to keep them as a string? This may seem very basic to you but I really hardly know anything!

if I use

"bad word" will that let me identify anything with "bad word" in it but if I leave it as bad word without the quotes, it would match anything with b or a or d or space or w or o or r. I am using regular expressions in a spam filter and i guess this is how the regular expression works but I don't really know. The spam filter manual says you can use regular expressions but doesn't give any guidance on syntax. Can you also recommend a good reference for regular expressions for beginners.

Thanks again for all your help,

Mair
# 10  
Old 10-15-2005
grep "bad word" file1 file2 file3
Search for the phrase "bad word" in the files named "file1", "file2", and "file3".

grep bad word file1 file2 file3
Search for the word "bad" in the files named "word", "file1", "file2", and "file3".
# 11  
Old 10-15-2005
not sure context is right

I am using a spam filter which has drop downs which let you choose what part of the e-mail you want to examine and then either 'matches' or 'contains' and then a 'pattern'. In the 'pattern' you can use regular expressions so I don't have to key in grep or any file names. The way this seems to work is that if I put in the pattern say

abc

and tell it to reject all e-mails where the subject line contains this pattern, it will reject any subject line with a or b or c in it.

I am guessing (and i won't be able to try it out till monday) that if i put in

"abc"

it will reject e-mails with abc all together in the subject line... sorry this is probably not what this forum is all about but you are the only place i have found where it seems i can get some real help. Looking forward to trying it all out on Monday and will let you know how it goes.
# 12  
Old 10-16-2005
You may not need quotes then. In that case "abc" might reject subject lines with abc as you suggest. Or it may reject lines with "abc" on the subject line. Try it both ways.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match exactly a string

I am formatting my code and for that I am trying to write a script which can quicken some repetitive work. I need to match "==" exactly in a string and replace it by inserting a (single) blank space before and after it. Sample Strings: 1.this.something =='something'.that... (9 Replies)
Discussion started by: prohank
9 Replies

2. Shell Programming and Scripting

Print ALL lines except if field is 999

Hi All!!! :-) I need a command that will print each line of a text file UNLESS the 3rd field of that line is equal to the number 999. (space seperated fields) Solaris10/BASH SHELL: INPUT.TXT aaa bbb 111 222 ccc ddd 333 444 eee fff 999 555 ggg hhh 666 777 aaa bbb 999 222 ccc ddd 333... (7 Replies)
Discussion started by: ajp7701
7 Replies

3. Shell Programming and Scripting

awk : match the string and string with the quotes :

Hi all, Here is the data file: - want to match only lan3 in the output . - not lan3:1 file : OPERATING_SYSTEM=HP-UX LOOPBACK_ADDRESS=127.0.0.1 INTERFACE_NAME="lan3" IP_ADDRESS="10.53.52.241" SUBNET_MASK="255.255.255.192" BROADCAST_ADDRESS="" INTERFACE_STATE=""... (2 Replies)
Discussion started by: rveri
2 Replies

4. Shell Programming and Scripting

Match all except string(s) in posix extended

How to say "match anything but this or that string" using only posix extended syntax? I am not talking about egrep -v, I want this done entirely by the regular expression. Thanks (7 Replies)
Discussion started by: stevensw
7 Replies

5. Shell Programming and Scripting

Generate numbers 000 to 999

I have tried to make this script to generate: 000 001 002 ... 997 998 999 i=0 while do if then echo "00"$i else if && then echo "0"$i (5 Replies)
Discussion started by: locoroco
5 Replies

6. Shell Programming and Scripting

exact string match ; search and print match

I am trying to match a pattern exactly in a shell script. I have tried two methods awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies

7. Shell Programming and Scripting

Perl: Better way to match string within a string

Hi, I'm trying to get one field out of many as follows: A string of multiple fields separated with "/" characters: "/ab=12/cd=34/12=ab/34=cd/ef=pick-this.one/gh=blah/ij=something/" I want to pick up the field "ef=pick-this.one" which has no regular pattern except it starts with "ef=xxxx"... (3 Replies)
Discussion started by: Juha
3 Replies
Login or Register to Ask a Question