Re: extracting value from a field in awk
- From: gazelle@xxxxxxxxxxxxxxxxxxxxx (Kenny McCormack)
- Date: Sun, 1 Jul 2007 17:48:38 +0000 (UTC)
In article <1183310331.478346.252980@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<new299@xxxxxxxxxxxxxx> wrote:
Hi,
I have lines in a file that look like this:
all_initstring0010010100111000/1dca.rule118.iter100.score
all_initstring0010010100111000/1dca.rule140.iter100.score: 0
I want to extract from these lines the value after rule and before '.'
as well as the third field so for this example I'd get:
.................^^^^^? Sure you don't mean second?
118 140 0
Getting the fields out is trivial in awk but how to I parse the fields
to extract the value I'm looking for?
Thanks for your time, apologies if this is the wrong forum for this
request.
Your description/text is a little murky (unclear what you mean by
"getting ... is trivial but how do I ..." - where both ...s refer to
essentially the same activity).
But, I'm guessing you want something like:
sub(/^.*rule/,"") { print $0+0,$2 }
.
- Follow-Ups:
- Re: extracting value from a field in awk
- From: new299
- Re: extracting value from a field in awk
- References:
- extracting value from a field in awk
- From: new299
- extracting value from a field in awk
- Prev by Date: extracting value from a field in awk
- Next by Date: Re: extracting value from a field in awk
- Previous by thread: extracting value from a field in awk
- Next by thread: Re: extracting value from a field in awk
- Index(es):
Relevant Pages
|