ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <umag...@apache.org>
Subject Re: How to read a file without the first n lines
Date Tue, 08 Apr 2003 16:14:56 GMT
Instead of overloading the meaning of number of "lines"
and try to resemble Unix syntax closely, I suggest that 
a new attribute be introduced namely "skip" which would 
convey the number of lines that should be skipped before 
the head or tail operation is performed.

<!-- Get the first ten lines after skipping 2 lines -->
<head lines="10" skip="2"/>

<!-- Get the last ten lines after skipping last 3 lines -->
<tail lines="10" skip="3"/>

The lines attribute would logically have to be
optional.

I do not think a new filter like subfilter is necessary -
sub filter is actually a comination of two filter readers
in the filter chain - namely tail and head (with the
above suggested modification).

Cheers,
Magesh


----- Original Message ----- 
From: "Stefan Bodewig" <bodewig@apache.org>
To: <user@ant.apache.org>
Sent: Tuesday, April 08, 2003 12:04 PM
Subject: Re: How to read a file without the first n lines


> On Tue, 8 Apr 2003, Dominique Devienne <DDevienne@lgc.com> wrote:
> 
> > Does that mean you are +1 or -1 for this extension? Seems logical to
> > me.
> 
> In the head-spinning sematics of tail's argument (-1 == 1 and +1 != 1)?
> 8-)
> 
> It means that supporting a way to filter everything after the first n
> lines seems a good idea - yes, that's a +1 to the concept.
> 
> Following the Unix tools would mean <tailfilter lines="+10"/> if you
> wanted the first ten lines, this is not intuitive at all - and not
> doable without breaking the API.
> 
> What would be the alternative, now that we are unable to be compatible
> to tail(1) anyway?
> 
> <tailfilter lines="-10"/>?  
> 
> <somenewfilter startline="10" endline="-2"/> to read from line 10 and
> drop the last two lines as well (here positive numbers count from the
> start and negatives from the end)?
> 
> In the later case, <tailfilter lines="X"/> would be equivalent to
> <somenewfilter startline="-X"/> and <headfilter lines="X"/> was
> <somenewfilter endline="X+1"/>.  Something the implementations of head-
> and tailfilter could take advantage of.
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


Mime
View raw message