From owner-freebsd-questions@freebsd.org  Tue Aug 25 23:26:01 2020
Return-Path: <owner-freebsd-questions@freebsd.org>
Delivered-To: freebsd-questions@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 199323C0694
 for <freebsd-questions@mailman.nyi.freebsd.org>;
 Tue, 25 Aug 2020 23:26:01 +0000 (UTC) (envelope-from dr.klepp@gmx.at)
Received: from vie01a-dmta-at50-1.mx.upcmail.net
 (vie01a-dmta-at50-1.mx.upcmail.net [62.179.121.136])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 4BblVH0Q9zz4KKK
 for <freebsd-questions@freebsd.org>; Tue, 25 Aug 2020 23:25:58 +0000 (UTC)
 (envelope-from dr.klepp@gmx.at)
Received: from [172.31.216.41] (helo=vie01a-pemc-psmtp-at50)
 by vie01a-dmta-at50.mx.upcmail.net with esmtp (Exim 4.92)
 (envelope-from <dr.klepp@gmx.at>) id 1kAiKC-0000tF-DO
 for freebsd-questions@freebsd.org; Wed, 26 Aug 2020 01:25:56 +0200
Received: from t61.lan ([85.126.97.210])
 by vie01a-pemc-psmtp-at50 with SMTP @ mailcloud.upcmail.net
 id KzRw2300F4YLlkt0BzRwgh; Wed, 26 Aug 2020 01:25:56 +0200
X-SourceIP: 85.126.97.210
X-CNFS-Analysis: v=2.2 cv=O6RJhF1W c=1 sm=2 tr=0 cx=a_idp_f
 a=/Ac8Q0O/YFE5LOLfUiYZVw==:117 a=/Ac8Q0O/YFE5LOLfUiYZVw==:17
 a=8nJEP1OIZ-IA:10 a=8NP7CG0kedU35lt0mN8A:9 a=wPNLvfGTeEIA:10
From: "Dr. Nikolaus Klepp" <dr.klepp@gmx.at>
To: freebsd-questions@freebsd.org
Subject: Re: Sed pattern help - not FreeBSD related
Date: Wed, 26 Aug 2020 01:25:55 +0200
User-Agent: KMail/1.9.10
References: <6B02E882-D3EE-4721-B572-BFAF5C6BAC66@kukulies.org>
 <81c68558-175c-efef-7e43-e6cb87f3329b@tundraware.com>
 <5f319e25-5eaf-1ae1-3695-9a1fcc01f9be@tundraware.com>
In-Reply-To: <5f319e25-5eaf-1ae1-3695-9a1fcc01f9be@tundraware.com>
X-KMail-QuotePrefix: > 
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <202008260125.55781.dr.klepp@gmx.at>
X-Rspamd-Queue-Id: 4BblVH0Q9zz4KKK
X-Spamd-Bar: ++++
Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none;
 spf=fail (mx1.freebsd.org: domain of dr.klepp@gmx.at does not designate
 62.179.121.136 as permitted sender) smtp.mailfrom=dr.klepp@gmx.at
X-Spamd-Result: default: False [4.28 / 15.00]; RCVD_TLS_LAST(0.00)[];
 R_SPF_FAIL(1.00)[-all]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[];
 FREEMAIL_FROM(0.00)[gmx.at]; TO_MATCH_ENVRCPT_ALL(0.00)[];
 MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[];
 DMARC_NA(0.00)[gmx.at]; NEURAL_SPAM_MEDIUM(0.76)[0.763];
 RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3];
 NEURAL_SPAM_SHORT(0.72)[0.721]; MID_CONTAINS_FROM(1.00)[];
 FROM_NAME_HAS_TITLE(1.00)[dr]; FROM_EQ_ENVFROM(0.00)[];
 R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmx.at];
 ASN(0.00)[asn:6830, ipnet:62.179.0.0/17, country:AT];
 MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[freebsd-questions];
 RCVD_IN_DNSWL_LOW(-0.10)[62.179.121.136:from]
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.33
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 25 Aug 2020 23:26:01 -0000

Anno domini 2020 Tue, 25 Aug 18:05:45 -0500
 Tim Daneliuk scripsit:
> On 8/25/20 5:44 PM, Tim Daneliuk wrote:
> > On 8/25/20 4:02 PM, Christoph Kukulies wrote:
> >> Excuses, the result should look like: (forgot the DC)
> >>
> >>> LOOP:   DC LOOP+2
> >>> DO:	      DC DO+2
> >>> J:	     DC J+2
> >>> ENCL:	DC ENCL+2  PDP-11 VERSION OF ENCLOSE
> >>> KEY	     DC KEY+2
> >>> EMIT	DC EMIT+2
> >>> QTERM	DC QTERM+2
> > 
> > Here is a  one-liner using sed and awk.  It suffers from two deficiencies:
> > 
> > - It does not handle arbitrarily long comments
> > - It's really ugly
> > 
> >    sed s/':'//g < myfile | awk '{print $1":", $2, $1"+2", $4, $5, $6, $7, $8, $9. $10}'
> > 
> 
> 
> Oops, not quite right because it inserts colons blindly in the first field -
> which appears not what you want.  More correct implementation in Python:
> 
> !/usr/bin/env python
> 
> import sys
> 
> for line in sys.stdin.readlines():
> 
>     line = line.strip().split()
>     label = line[0]
>     comment = " ".join(line[3:])
>     print("%s    DC   %s+2    %s" %(label, label.replace(':', ''), comment))
> 
> 
> 


sed 's#^\([^ \t]*\)\([^*]*\)[*]#\1\2\1#' <el2


nik



-- 
Please do not email me anything that you are not comfortable also sharing with the NSA, CIA ...