Sponsored Content
Top Forums Shell Programming and Scripting gnu sed regex grouping not working? Post 302278641 by Allasso on Tuesday 20th of January 2009 07:56:23 PM
Old 01-20-2009
thank you for your reply.

Your example works fine for what it does, but the whole point is to be able to use the square brackets so I can use the NOT form -- [^...] -- in order to keep the match from being greedy.

Are you saying that you cannot have a group inside of [...] ?

Last edited by Allasso; 01-20-2009 at 09:11 PM.. Reason: clarity
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grouping using sed/awk ?

I run awk cat $1|awk '{print $6}' and get a lot of results and I want results to group them. For example my result is (o/p is unknown to user) xyz xyz abc pqr xyz pqr etc I wanna group them as xyz=total found 7 abc=total .... pqr= Thank (3 Replies)
Discussion started by: pujansrt
3 Replies

2. Shell Programming and Scripting

SED:: Using variable while grouping

Hi, I have the following script :- #!/bin/csh -f set var="HOST2" sed -e 's/\(.*TRANSFER TO\).*\(usr\)/\1 "$var" \2/' tempFile tempFile contains: STOP TRANSFER TO HOST1 /usr/bin/myscript 1. How to use variable in the above sed command. It replaces with $var... (6 Replies)
Discussion started by: angshuman_ag
6 Replies

3. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

4. UNIX for Dummies Questions & Answers

Trouble with grouping regex

Hi Forum im trying to use grouping in a regex statement in a function in a script this is the criteria im trying to match :It MUST have 3 character at the beginning. After that it can have a mix of spaces,alpha-numeric and dashes in any order eg HUG this-stuff, FGU taylor-8-shoes, ZDFnintendo... (2 Replies)
Discussion started by: ShinTec
2 Replies

5. Shell Programming and Scripting

matching a regex using egrep not working

Hi, I'm trying to validate if a string matches a regular expression, but it is not working. Am I missing something? Do I need to scape any of the characters? if echo 'en-GB' | egrep '({1,8})(-{1,8})*' >/dev/null; then echo Valid value fi Thanks in advance (6 Replies)
Discussion started by: skrtxao
6 Replies

6. Shell Programming and Scripting

Grouping sed commands

Hello, would you please help me with why my SED command file is outputting the entire input file instead of only the text that I'm trying to block? cat testfile O 111111111-00 DUE-DATE METHOD: FREQUENCY: O 222222222-00 DUE-DATE METHOD: FREQUENCY: O 333333333-02 DUE-DATE METHOD:... (4 Replies)
Discussion started by: lneedh1
4 Replies

7. Shell Programming and Scripting

grouping using sed or awk

I have below inside a file. 11.22.33.44 user1 11.22.33.55 user2 I need this manipulated as alias server1.domain.com='ssh user1@11.22.33.44' alias server2.domain.com='ssh user2@11.22.33.55' (3 Replies)
Discussion started by: anil510
3 Replies

8. UNIX for Dummies Questions & Answers

Gsub regex not working

I have a number of files that I pass through awk/gsub. I believe to have found a working regex and on 'test bed' sites it matches, however within gsub it does not. Examples: Initial data: /Volumes/Daniel/Public/Drop Box/_Hellsing_Ultimate_OVA_-_10_.mkv gsub & regex: gsub("\]+\]","" ... (4 Replies)
Discussion started by: unknownn
4 Replies

9. Shell Programming and Scripting

Regex not working

I am using a regex to exactly match a string abcdef as ^abcdef$. But it does'nt seem to work :( (11 Replies)
Discussion started by: gaurav99
11 Replies

10. Shell Programming and Scripting

Using GNU Regex

I'm just learning Regex and while testing my understanding I received some unexpected results. I created example.txt with the text "abcddd". Running the command grep --color 'd' example.txt I received the results: "abcddd" with the first and second letter d highlighted in red. So... (1 Reply)
Discussion started by: rthomas529
1 Replies
Mail::Milter::Module::ConnectRegex(3pm) 		User Contributed Perl Documentation		   Mail::Milter::Module::ConnectRegex(3pm)

NAME
Mail::Milter::Module::ConnectRegex - milter to accept/reject connecting hosts matching regex(es) SYNOPSIS
use Mail::Milter::Module::ConnectRegex; my $milter = new Mail::Milter::Module::ConnectRegex('^foo$'); my $milter2 = &ConnectRegex(qw{^foo$ ^bar$}); # convenience $milter2->set_message('Connections from %H disallowed'); DESCRIPTION
This milter module rejects any connecting host whose hostname or IP address matches user-supplied regular expressions. It can also func- tion as a whitelisting Chain element; see "accept_match()". METHODS
new(REGEX[, ...]) Accepts one or more regular expressions, as strings or qr// precompiled regexes. They are tested in sequence, and the first match ter- minates checking. Note that all IP address literals will be enclosed in [square brackets]; so to test an IP address rather than a hostname, ensure those brackets exist: ^[ADDRESS]$ accept_match(FLAG) If FLAG is 0 (the default), a matching regex will cause the connection to be rejected. If FLAG is 1, a matching regex will cause this module to return SMFIS_ACCEPT instead. This allows a "ConnectRegex" to be used inside a "Mail::Milter::Chain" container (in accept_break(1) mode), to function as a whitelist rather than a blacklist. This method returns a reference to the object itself, allowing this method call to be chained. set_message(MESSAGE) Sets the message used when rejecting connections. This string may contain the substring %H, which will be replaced by the matching hostname or IP address. This method returns a reference to the object itself, allowing this method call to be chained. BUGS
In Sendmail 8.11 and 8.12, a milter rejection at "connect" stage does not allow the reply message to be set -- it simply becomes "not accepting messages". However, this module still attempts to set the reply code and message in the hope that this will be fixed. AUTHOR
Todd Vierling, <tv@duh.org> <tv@pobox.com> SEE ALSO
Mail::Milter::Object perl v5.8.8 2004-02-26 Mail::Milter::Module::ConnectRegex(3pm)
All times are GMT -4. The time now is 12:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy