Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Sep 2006 11:35:51 -0500
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        SigmaX asdf <fydernix@gmail.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: sed and comma-delimited file
Message-ID:  <20060919163551.GB52635@lor.one-eyed-alien.net>
In-Reply-To: <c04d7e300609190926t1e5dce14wea7ef1a16ccf9af1@mail.gmail.com>
References:  <c04d7e300609190926t1e5dce14wea7ef1a16ccf9af1@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--dTy3Mrz/UPE2dbVg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Sep 19, 2006 at 12:26:54PM -0400, SigmaX asdf wrote:
> Yo;
>=20
> I have a series of comma-delimited text files with fourteen columns of
> data and several hundred rows.  I want to use a short shell script to
> strip them of the last 9 columns, leaving the same file but with just
> five of its columns.  I can do it in C++, but that seems like
> overkill.  How would I go about doing it with sed or a similar
> utility?

See cut(1):

cut -d, -f1,2,3,4,5

-- Brooks

--dTy3Mrz/UPE2dbVg
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFEBxmXY6L6fI4GtQRArYeAJ0X2xtonmVoAF+478VJl0Wj6gx7TwCgoufr
O4SZHaq9a/J4e/qLsSBdq58=
=uRVl
-----END PGP SIGNATURE-----

--dTy3Mrz/UPE2dbVg--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060919163551.GB52635>