Sponsored Content
Top Forums Programming Wildcard Pattern Matching In C Post 302976676 by Azrael on Sunday 3rd of July 2016 04:45:57 PM
Old 07-03-2016
Thank you Don Cragun! That does work correctly and is a lot cleaner!

I'm still interested in statically pre-compiling the regex to a text file that jim mcnamara mentioned. If anyone has any examples of that let me know.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find wildcard .shtml files in wildcard directories and removing them- How's it done?

I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days... The structure of the paths are like this: /home/domains/www.domain2.com/tgp/ /home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies

2. Shell Programming and Scripting

comment/delete a particular pattern starting from second line of the matching pattern

Hi, I have file 1.txt with following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433 ** ** ** In file 2.txt I have the following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies

3. Shell Programming and Scripting

counting the lines matching a pattern, in between two pattern, and generate a tab

Hi all, I'm looking for some help. I have a file (very long) that is organized like below: >Cluster 0 0 283nt, >01_FRYJ6ZM12HMXZS... at +/99% 1 279nt, >01_FRYJ6ZM12HN12A... at +/99% 2 281nt, >01_FRYJ6ZM12HM4TS... at +/99% 3 283nt, >01_FRYJ6ZM12HM946... at +/99% 4 279nt,... (4 Replies)
Discussion started by: d.chauliac
4 Replies

4. UNIX for Dummies Questions & Answers

sed non-greedy pattern matching with wildcard

Toby> cat sample1 This is some arbitrary text before var1, This IS SOME DIFFERENT ARBITRARY TEXT before var2 Toby> sed -e 's/^This .* before //' -e 's/This .* before //' sample1 var2 I need to convert the above text in sample1 so that the output becomes var1, var2 by... (2 Replies)
Discussion started by: TobyNorris
2 Replies

5. UNIX for Dummies Questions & Answers

Find pattern suffix matching pattern

Hi, I am trying to get a result out of this but fails please help. Have two files /tmp/1 & /tmp/hosts. /tmp/1 IP=123.456.789.01 WAS_HOSTNAME=abcdefgh.was.tb.dsdc /tmp/hosts 123.456.789.01 I want this result in /tmp/hosts if hostname is already there dont want duplicate entry. ... (5 Replies)
Discussion started by: rajeshwebspere
5 Replies

6. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

7. Shell Programming and Scripting

PHP - Regex for matching string containing pattern but without pattern itself

The sample file: dept1: user1,user2,user3 dept2: user4,user5,user6 dept3: user7,user8,user9 I want to match by '/^dept2.*/' but don't want to have substring 'dept2:' in output. How to compose such regex? (8 Replies)
Discussion started by: urello
8 Replies

8. UNIX for Dummies Questions & Answers

Grep -v lines starting with pattern 1 and not matching pattern 2

Hi all! Thanks for taking the time to view this! I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern. Example: Drink a soda Eat a banana Eat multiple bananas Drink an apple juice Eat an apple Eat multiple apples I... (8 Replies)
Discussion started by: demmel
8 Replies

9. Shell Programming and Scripting

Grep and BzGrep with Wildcard in Search Pattern

Hello All, I hope this is the right area. If not, Kindly let me know and I will report in the appropriate spot. I am needing to find a search pattern that will make the * act as Wildcard in the search pattern instead of being literal. The example I am using is bzgrep "to=<*@domain.com>"... (5 Replies)
Discussion started by: mancountry
5 Replies

10. Shell Programming and Scripting

Replace String matching wildcard pattern

Hi, I know how to replace a string with another in a file. But, i wish to replace the below string pattern EncryptedPassword="{gafgfa}]\asffafsf312a" i.e EncryptedPassword="<any random string>" To EncryptedPassword="" i.e remove the random password to a empty string. Can you... (3 Replies)
Discussion started by: mohtashims
3 Replies
ACHECK-RULES.5(5)					User Contributed Perl Documentation					 ACHECK-RULES.5(5)

NAME
set.rules - Rules set for acheck DESCRIPTION
Rules set files contain rules to be check by acheck. Lines beginning with a number sign (`#') and empty lines will be ignored. Spaces at the beginning and the end of a line will also be ignored as well as tabulators. If you need spaces at the end or the beginning of a value you can use apostrophes (`"'). A comment starts with the number sign, there can be any number of spaces and/or tab stops in front of the #. Long lines can be broken into multiple lines ending with a backslash (`'). Some possible examples: # this line is ignored field value field value # this is a comment field "value ending with space " field value continuing on the next line You have to escape number signs with a backslash to use it in a value and use apostrophes if a value ends with a backslash. Rule sets are made of lists of rules. Theses lists can be repeated a number of times, until or while a condition happens. A rule detects an error if the corresponding test succeeds and none of its validation tests does. Each rule can then produce some fixes, a warning or an error, and provide hints to help the operator to correct the error. Parts of the text can be set as comments and so no rule and no spell check will be performed on them. RULE FILE SYNTAX
SYNTAX RULES
list A list starts at a `list' statement, and stops at the first `end_list' or at the end of the file. Mandatory fields: type type until, perform the list until the current line matches `test' while, perform the lint while the current line matches `test' loop, perform the list `test' times test regex / number A regex for `until' and `while' lists. The number of times the list must be performed for `loop', or `0' for infinite loop. Optional fields: name name Use this to give the list a name. spell yes / no Set it to `yes' (default) or `no', if you want or don't want spelling to be checked in the lines matching this list. This value will be inherited by the nested lists. Sub-rules: list [name] rule [name] comment [name] Followed by the name of the sub-rule or its definition for an anonymous sub-rule. rule A rule starts at a `rule' statement, and stops at the first `end_rule' or at the beginning of a comment or a list. Mandatory fields: type type fix, rule provides fixes and hints thought a menu autofix, rule fixes the mistake with no interaction warning, rule issues a warning error, rule issues an error nop, special rule that do nothing, no other field is required regex regex The regex to be match to found this error. Patterns can be captures and then used in the `fix' expression. fix expr Provides a correction for the rule, this field can be repeated to provides more than one choice. Only the first one will be used for `autofix' rules. `warning' and `error' do not provides fixes. The captured patterns can be used here with variables `$1', `$2', and so on. hint text Provides some explanations, this will be used as reviewer comments in review mode. Optional fields: name name Use this to give the rule a name. valid [name] Provides a validation test, it can be named or anonymous. For anonymous validation, the test definition must follow. This field can be repeated more than once, if any of the validation test succeed, the rule does not apply. valid A validation test starts at a `valid' statement, and stops at the first `end_valid' or at the beginning of a rule, a comment, a list or another validation test. Mandatory field: pre regex in regex> post regex Try the regex before, in or after the match of the regex rule. At least one of these test must be provided. If all tests are success- ful, the rule won't apply. Optional field: name name Use this to give the validation test a name. comment A comment starts at a `comment' statement, and stops at the first `end_comment' or at the beginning of a rule, a comment or a list. Comments are just skipped, no other rule and no spelling are performed on them. Mandatory field: skip regex A regex matching the text of the comment. Do not use `start' and `stop' with this. start regex stop regex Regexs defining the beginning and the end of the comment, all the text between will be considered as comment. Do not use `skip' with this. Optional fields: name name Use this to give the comment a name. start_offset stop_offset Defines where the comment really starts or end. Values are `s' for the place the match starts, `s+<n>' for n characters after the match starts, `e' for the place the match ends, or `e-<n>' for n characters before the match ends. Defaults are `s' for `start' matches and `e' for `stop' matches. SEE ALSO
acheck(1), acheck(5) AUTHOR
Nicolas Bertolissio <nico.bertol@free.fr> perl v5.8.4 2003-07-20 ACHECK-RULES.5(5)
All times are GMT -4. The time now is 05:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy