Re: access nth argument list in a file

From: Ed Morton (morton_at_lsupcaemnt.com)
Date: 03/22/05


Date: Mon, 21 Mar 2005 18:23:43 -0600


zippy747 wrote:
> I have a file that has this content:
>
> includes="a b c d"
> somethingelse="foo"
> includes="e f g h"
>
> I want to parse out each token after an includes=
>
> In this case I want to parse out
> a
> b
> c
> d
> e
> f
> g
>
> Thanks,
> -zip
>

Assuming you mean to include "h" in the output and that the only double
quotes are around the string of tokens:

awk '/^includes/{gsub("\""," ");for (i=2;i<=NF;i++) print $i}' file

        Ed.



Relevant Pages

  • Re: LaTeX-Like Parsing in C
    ... I parse it, and then I ... strpbrkHow can I get the string ... Store your lexical tokens in some kind of dynamic ... And again, if you end up with a sufficiently complex grammar, ...
    (comp.lang.c)
  • Re: Parsing a config file
    ... How can I write a program to parse a configuration/ ... I was thinking of a config/parameter file that looks ... peeking and eating tokens can also be addressed, ... parser, where usually some kind of IR is built, such as an AST (abstract ...
    (comp.programming)
  • Reprise: in out parameters for functions
    ... (Error_Label: in String; ... -- Delete parsed tokens from Token. ... because the next parse function called wants ...
    (comp.lang.ada)
  • Re: php var name as string
    ... doesn't have to parse the string. ... Whenever PHP hits double quotes it then parses EVERYTHING withing the ... LDAP Help: http://forums.devshed.com/f76/s ...
    (alt.php)
  • Re: CS vs Parsing?
    ... What is the difference between Constraint Satisfaction and Parsing? ... so, to satisfy constraints, you satisfy constraints. ... now, to parse something, you decompose it into tokens and build a parse ... of checking tokens, recursing, and building trees... ...
    (comp.ai)