Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

behaviour of lsearch -regexp -inline

54 views
Skip to first unread message

Svenn Are Bjerkem

unread,
Apr 6, 2011, 7:35:13 AM4/6/11
to
The following test

lsearch -inline -regexp {-gin=in.csv -gout=out.csv} -gin=(.+)

Reports
-gin=vst.csv

I guess it is not possible with lsearch to have the matching (.+) only reported?
Currently I use another line of regexp to get the text after = into a variable.

--
Svenn

nedbrek

unread,
Apr 7, 2011, 7:52:42 AM4/7/11
to
Hello,

"Svenn Are Bjerkem" <svenn....@googlemail.com> wrote in message
news:cdd700fa-32d3-4f2c...@glegroupsg2000goo.googlegroups.com...

lsearch is finding list elements which match a pattern. Your first (real)
argument is the list, with two elements (gin and gout). The pattern matches
the first element, and that is returned inline (otherwise, it would return
the index - "0").

Dependening on what your list looks like, you might be able to use:
regexp -- {-gin=(.+) } {-gin=in.csv -gout=out.csv} -> match

(note: I added a space after ".+" because .+ matches everything)
"match" should have "in.csv". (the whole -gin=in.cvs goes into a variable
named "->")

If your list is very complicated (with escapes), you are probably better off
with your two step process (lsearch followed by regexp).

Hope that helps!
Ned


0 new messages