l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2001 Dec 30 16:58

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] regex expansion tool, anyone?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] regex expansion tool, anyone?


  • Subject: Re: [vox-tech] regex expansion tool, anyone?
  • From: Chuck Polisher <cpolish@MAPSns.net>
  • Date: Tue, 28 Nov 2000 19:51:33 -0800
  • References: 20001127132311.A16553@houseag.com

> Does anyone know of a tool that will show all possible matches to character
> class regexes? E.g., [a-f][RvP][3fk].

#!/bin/bash
# showmatch: show strings that match regular expresion
# usage: showmatch [regular expression] [file] 
pat=$1; shift
gawk 'match($0,pat) > 0 {
        s = substr($0,1,RSTART-1)
        m = substr($0,1,RLENGTH)
        gsub (/[^\b- ]/, " ", s)
        gsub (/./,       "^", m)
        printf "%s\n%s%s\n", $0, s, m
}' pat="$pat" $*

source: Unix Power Tools, Peek, 2nd ed.


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.