From owner-freebsd-questions Thu Sep 19 12:40:40 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E54CF37B401 for ; Thu, 19 Sep 2002 12:40:39 -0700 (PDT) Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D48443E6A for ; Thu, 19 Sep 2002 12:40:39 -0700 (PDT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [IPv6:::1]) by lurza.secnetix.de (8.12.5/8.12.5) with ESMTP id g8JJeUmC069969; Thu, 19 Sep 2002 21:40:31 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.12.5/8.12.5/Submit) id g8JJeUGu069968; Thu, 19 Sep 2002 21:40:30 +0200 (CEST) Date: Thu, 19 Sep 2002 21:40:30 +0200 (CEST) Message-Id: <200209191940.g8JJeUGu069968@lurza.secnetix.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG, mbettinger@championelevators.com Reply-To: freebsd-questions@FreeBSD.ORG, mbettinger@championelevators.com Subject: Re: OT sed help In-Reply-To: <200209190938.35632.matt@championelevators.com> X-Newsgroups: list.freebsd-questions User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.6-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Matthew Bettinger wrote: > I have a flat file that I need to import into a database. The first field of > the file is a part number which cannot exceed more than 8 characters. > > Does anyone know how I can use sed to count the characters in the first field > and if there are more than 8 print out a list? It's probably easiest to use awk for that job: awk '(length($1) > 8)' flatfile.txt Regards Oliver -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "All that we see or seem is just a dream within a dream" (E. A. Poe) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message