🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: best.general
Article #1661

Re: Examining strings in files

#1661
From: Jimmy Aitken
Date: Tue, 07 Nov 1995 00:00
29 lines
1973 bytes
In article <47n1ui$l93@shellx.best.com>, Zenin  <zenin@shellx> wrote:
>Jimmy Aitken <petejim@shellx.best.com> wrote:
>	>snip<
>: If this case you could try:
>: perl -ne 'print "$1\n" if /\sPRIV:\s(.*?)\s/;' datafile
>
>	And yet another way...
>
>		grep PRIV: datafile | sed "s/^.*PRIV: //"
>	-can you tell I like sed... :)

I thought he only wanted the next field after the 'PRIV:" text which is
why I put the perl solution up.  Perl has minimal regexp matches which
is why I used it rather than awk/sed solutions.  There are certainly
ways to do the matching in sed/awk pipelines, but I'm more at ease
with perl so that's what I wrote it in.
e.g.:
sed '/PRIV:/s/^.*PRIV: //' datafile | awk '{print $2}'

Cheers,
Jimmy
[posted and mailed]
--
jimmy@pyramid.com [work]        -m-------  Jimmy Aitken
jimmy@peter.com   [home]      ---mmm-----  Pyramid Technology Corp.
 __                         -----mmmmm---  3860 N. First St. San Jose CA 95134
 \/ http://www.peter.com  -------mmmmmmm-  **PGP Key available on request**
`Rrrrum Ti-Tum Ti-Tum Ti-Tum, Rrrrum Ti-Tum Ti Ta-Ta,
 Rrrrum Ti-Tum Ti-Tum Ti-Tum, Rrrrum Ti Tiddly Ta...'
Technical Details
Message-ID: <47o849$gpq@shellx.best.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <47jf89$k7c@shellx.best.com> <47kdad$ap7@shellx.best.com> <47ldlf$8oe@shellx.best.com> <47n1ui$l93@shellx.best.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f9f6d,4d51e96cce84d80f
X-Google-Attributes: gidf9f6d,public
X-Google-Thread: 161bbf,4d51e96cce84d80f
X-Google-Attributes: gid161bbf,public
X-Google-Thread: 11488e,4d51e96cce84d80f
X-Google-Attributes: gid11488e,public
X-Google-Thread: fd796,81754fefbd7cf85c
X-Google-Attributes: gidfd796,public
From: petejim@shellx.best.com (Jimmy Aitken)
Subject: Re: Examining strings in files
Date: 1995/11/07
Message-ID: <47o849$gpq@shellx.best.com>
X-Deja-AN: 118856561
references: <47jf89$k7c@shellx.best.com> <47kdad$ap7@shellx.best.com> <47ldlf$8oe@shellx.best.com> <47n1ui$l93@shellx.best.com>
organization: Best Internet Communications
reply-to: jimmy@pyramid.com
newsgroups: best.general,best.schaft,best.www,comp.infosystems.www.authoring.cgi