Re: OT sed help

2002-09-19 Thread Matthew Bettinger

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thanks for the solution.

Informix fun fun ...

Matt


On Thursday 19 September 2002 02:40 pm, Oliver Fromme wrote:
> Matthew Bettinger <[EMAIL PROTECTED]> 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
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE9ik1vXG7+MmNwciURAtgqAKCkcmKuBbKcVAy8T4kydXbQPuA7WQCcC27c
pCpQllkmCZp0aIIhiWqE7lo=
=l7D5
-END PGP SIGNATURE-


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: OT sed help

2002-09-19 Thread Oliver Fromme

Matthew Bettinger <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: OT sed help

2002-09-19 Thread Roman Neuhauser

# [EMAIL PROTECTED] / 2002-09-19 09:38:33 -0500:
> 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?

untested:

% grep -En '^\w{9,}' yourfile

-- 
begin 666 nonexistent.vbs
FreeBSD 4.7-RC
5:15PM up 2 days, 30 mins, 24 users, load averages: 0.01, 0.00, 0.00
end

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



RE: OT sed help

2002-09-19 Thread Barry Byrne

Matt:

How about:

grep -E "^\w{9,}," flatfile.txt > morethaneight.txt

 - Barry

--
Barry Byrne, IT Manager,
WBT Systems, Block 2, Harcourt Centre
Harcourt Street, Dublin 2, Ireland

Phone:  +353 1 417 0150
Fax:+353 1 478 5544
Email:  [EMAIL PROTECTED]
Web:www.wbtsystems.com

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Matthew
> Bettinger
> Sent: 19 September 2002 15:39
> To: [EMAIL PROTECTED]
> Subject: OT sed help
> 
> 
> -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 [EMAIL PROTECTED]
> with "unsubscribe freebsd-questions" in the body of the message
> 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: OT sed help

2002-09-19 Thread Matt Smith

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 [EMAIL PROTECTED]
> with "unsubscribe freebsd-questions" in the body of the message
> 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message