From owner-freebsd-questions Thu Sep 19 7:54:12 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 E51F637B401 for ; Thu, 19 Sep 2002 07:54:10 -0700 (PDT) Received: from mail2.uits.uconn.edu (mail2.uits.uconn.edu [137.99.25.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B7BD43E4A for ; Thu, 19 Sep 2002 07:54:10 -0700 (PDT) (envelope-from matt@forsetti.com) Received: from d80h149.public.uconn.edu (d80h149.public.uconn.edu [137.99.80.149]) by mail2.uits.uconn.edu (8.11.6/8.11.6) with ESMTP id g8JErmh21288; Thu, 19 Sep 2002 10:53:48 -0400 Subject: Re: OT sed help From: Matt Smith To: mbettinger@championelevators.com Cc: freebsd-questions@FreeBSD.ORG In-Reply-To: <200209190938.35632.matt@championelevators.com> References: <200209190938.35632.matt@championelevators.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 19 Sep 2002 10:53:47 -0400 Message-Id: <1032447228.18054.2.camel@localhost> Mime-Version: 1.0 X-MailScanner: Found to be clean 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 Try these Use this if part numbers are numeric only. cat my_flat_file | sed /"^[0-9]\{8\}[^0-9].*$"/d Use this if part numbres are alpha-numeric, and columns are seperated by whitespace cat my_flat_file | sed /"^[0-9a-zA-Z]\{8\}.*$"/d These will both simply delete(from view, not from the file) compliant entries, displaying only non-compliant entries. On Thu, 2002-09-19 at 10:38, Matthew Bettinger wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello, > > I know this is off topic however I hope someone can help. > > 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? > > Thank you. > > Matt > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.7 (FreeBSD) > > iD8DBQE9ieFpXG7+MmNwciURAqRxAJsES932AbaFG0w4+1oGU+K6reogEwCgoEdx > ZEf/Vi3j8vq8HbO4t7gSAqY= > =taxV > -----END PGP SIGNATURE----- > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message