[Linux-Biella] erasefirstline

CIARROCCHI Paolo linux@bilug.linux.it
Tue, 9 Sep 2003 15:38:21 +0200


From: Claudio [mailto:cmaffio@bilug.linux.it]=20

> Il Tue, 9 Sep 2003 15:19:21 +0200
> "CIARROCCHI Paolo" <Paolo.CIARROCCHI@vodafone.com> scrisse:
>=20
> CP> Ciao a tutti,
> CP> mi sono spesso trovato nella situazione di
> CP> dover rimuovere la prima linea di un file e di=20
> CP> printarlo a schermo.
> CP>=20
> CP> Ho risolto il tutto con questo script:
> CP>=20
> CP> #!/usr/bin/bash
> CP> lines=3D$(cat $1|wc -l )
> CP> cat $1|tail -$((--lines))
> CP>=20
> CP> Esiste un modo migliore ?
>=20
> Si, tail
>=20
> NAME
>      tail - display the last part of a file
> =20
> SYNOPSIS
>      tail [-F | -f | -r] [-b number | -c number | -n number]=20
> [file ...]
> =20
> DESCRIPTION
> The tail utility displays the contents of file or, by=20
> default, its standard input, to the standard output.
> =20
> The display begins at a byte, line or 512-byte block location=20
> in the input.  Numbers having a leading plus (``+'') sign are=20
> relative to the =20
> beginning of the input, for example, ``-c +2'' starts the=20
> display at the second byte of the input.  Numbers having a=20
> leading minus(``-'') sign or no explicit sign are relative to=20
> the end of the input, for example,``-n=20
> 2'' displays the last two lines of the input.  The default=20
> starting location is ``-n 10'', or the last 10 lines of the input.

Cioe' ?
Come faccio ad usare tail in modo diverse da come l'ho usato io ?


		Paolo