[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash, sed: extracting regex subexpressions







On Tue, May 27, 2008 at 4:49 PM, John O'Hagan <johnmohagan@gmail.com> wrote:
Hi,

I've been looking for a command I can use in bash scripts that will do
something like this:

$COMMAND(n[,m...]) (REGEX-1)(REGEX-2)[...] <($FILE)

       (MATCH-n)[(MATCH-m)...]
A recent article talk about it in bash3.0:

if [[ "a,b,c" =~ ^(.).(.) ]]; then echo ok ${BASH_REMATCH[1]} ${BASH_REMATCH[2]} ; fi



Reply to: