ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: How to read a file without the first n lines
Date Tue, 08 Apr 2003 15:53:22 GMT
Ok, it seems that I need scenarios... (especially because I´m not working
with Unix).


Given the file
--8-<------8-<-------8-<------8-<-----
1
2
...  anknown number of lines go here
8
9
--8-<------8-<-------8-<------8-<-----

What should be extracted?

<head lines="2">
	1
	2

<tail lines="2">
	8
	9

<head lines="-2">
	...
	8
	9

<tail lines="-2">
	1
	2
	...


Jan



> -----Ursprüngliche Nachricht-----
> Von: Dominique Devienne [mailto:DDevienne@lgc.com]
> Gesendet am: Dienstag, 8. April 2003 17:47
> An: 'Ant Users List'
> Betreff: RE: How to read a file without the first n lines
> 
> Does that mean you are +1 or -1 for this extension? Seems 
> logical to me.
> 
> On a related note, something I discovered recently is that
> Integer.parseInt("+1") fails... Only the leading minus (-) is 
> recognized.
> 
> --DD
> 
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org] 
> Sent: Tuesday, April 08, 2003 10:45 AM
> To: user@ant.apache.org
> Subject: Re: How to read a file without the first n lines
> 
> On Tue, 8 Apr 2003, Jan Materne <Jan.Materne@rzf.fin-nrw.de> wrote:
> 
> > Especially if you suggestion is normal Unix-behaviour.
> 
> It is in POSIX.2 for tail, but not for head AFAIK.
> 
> In tail (from the BSD manpage):
> 
>  Numbers having a leading minus (``-'') sign or no explicit sign are
>  relative to the end of the input, for example, ``-n 2'' displays the
>  last two lines of the input.
> 
> Which means -n 2 and -n -2 are the same.  tail -n +2 will give you
> everything except the first two lines.
> 
> Unfortunately we can't make <tailfilter lines="+2"/> do anything
> different from <tailfilter lines="2"/> (setLines takes a long), so
> we'll have to live with being incompatible to the command line
> utility.
> 
> I just checked on my Linux system and it doesn't have something like a
> negative number for head either (the "give me everything except the
> last two lines" option).
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message