From owner-freebsd-stable@FreeBSD.ORG Tue Sep 19 16:50:52 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C16AF16A6AA for ; Tue, 19 Sep 2006 16:50:52 +0000 (UTC) (envelope-from njm@njm.f2s.com) Received: from outmail.freedom2surf.net (outmail1.freedom2surf.net [194.106.33.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id D61F143D7C for ; Tue, 19 Sep 2006 16:50:27 +0000 (GMT) (envelope-from njm@njm.f2s.com) Received: from ariel.njm.f2s.com (i-195-137-21-170.freedom2surf.net [195.137.21.170]) by outmail.freedom2surf.net (Postfix) with ESMTP id EC00D558B1 for ; Tue, 19 Sep 2006 17:49:16 +0100 (BST) Received: from ariel.njm.f2s.com (localhost.njm.f2s.com [127.0.0.1]) by ariel.njm.f2s.com (8.13.8/8.13.6) with ESMTP id k8JGnGxE023676 for ; Tue, 19 Sep 2006 17:49:16 +0100 (BST) (envelope-from njm@ariel.njm.f2s.com) Received: (from njm@localhost) by ariel.njm.f2s.com (8.13.8/8.13.8/Submit) id k8JGnFNE023675 for freebsd-stable@freebsd.org; Tue, 19 Sep 2006 17:49:15 +0100 (BST) (envelope-from njm) Date: Tue, 19 Sep 2006 17:49:15 +0100 From: "N.J. Mann" To: freebsd-stable@freebsd.org Message-ID: <20060919164915.GA23496@ariel.njm.f2s.com> Mail-Followup-To: freebsd-stable@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 6.2-PRERELEASE User-Agent: Mutt/1.5.13 (2006-08-11) Subject: Re: sed and comma-delimited file X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2006 16:50:52 -0000 On Tue 19 Sep 12:26, SigmaX asdf wrote: > 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? cut -d, -f 1-5 Cheers, Nick. -- "You call _that_ a knife? _This_ is what _I_ call a knife!" "Really? No worries. _This_ is what I call a crossbow!"