Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Aug 2020 09:04:29 +0200
From:      Christoph Kukulies <kuku@kukulies.org>
To:        Tim Daneliuk <tundra@tundraware.com>
Cc:        "Dr. Nikolaus Klepp" <dr.klepp@gmx.at>, freebsd-questions@freebsd.org
Subject:   Re: Sed pattern help - not FreeBSD related
Message-ID:  <98370951-3D75-4B31-B7EE-D7578BB44D2E@kukulies.org>
In-Reply-To: <dc18cd27-aa0b-9897-748c-10f742a4357d@tundraware.com>
References:  <6B02E882-D3EE-4721-B572-BFAF5C6BAC66@kukulies.org> <81c68558-175c-efef-7e43-e6cb87f3329b@tundraware.com> <5f319e25-5eaf-1ae1-3695-9a1fcc01f9be@tundraware.com> <202008260125.55781.dr.klepp@gmx.at> <dc18cd27-aa0b-9897-748c-10f742a4357d@tundraware.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]


> Am 26.08.2020 um 01:46 schrieb Tim Daneliuk <tundra@tundraware.com>:
> 
> On 8/25/20 6:25 PM, Dr. Nikolaus Klepp wrote:
>> 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
>> 
>> 


My problem was that BSD sed doesn’t recognize [ \t] as white space. GNU sed does.

I was trying the command under FreeBSD sed and macOS sed.

>> nik
>> 
>> 
>> 


[-- Attachment #2 --]
0	*H
010
	`He0	*H
	00xU!`0
	*H
0f10	UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PN0
200516152759Z
210516152759Z0o10	UDE1!0U400000005ec008dd373ad8ec10UChristoph Kukulies1 0	*H
	kuku@kukulies.org0"0
	*H
0
׮yF(Y-0h>?S^@ؗH]hY܀J&uibCK[O'[g<8!KzDR
/[r`a:`t|\i|{;yjO+KiֲHe|iyH
԰#rwzrJQl>%;V)	Ѿ_ע͠]E2cfGS3]ǯpv7030Uu(	˗V6n	0U00U#0Ɠdrj>TTy0VU O0M0K++0;09+-http://sec5.dgnservice.de/policies/index.html0>U705031/-http://sec5.dgnservice.de/crl/crl2-type-e.crl0U0U%0++0U0kuku@kukulies.org0
	*H
-@Q72R#:%ɧTcu1TJ2 #&.$Ѫ#Q9Ztx}n{$;E]H|E\@xJ=QKjmS8=|*N
RO>SLLQƗ@0#̘Kȗ,_ZԌ G*l]AJܙPdMDEjC&SKRtF0d5
ڌ>מppّ;{_"+050UJf%0
	*H
0a10	UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH10Udgnservice Root 7:PN0
161026092241Z
241026092241Z0f10	UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PN0"0
	*H
0
ܥ?tǣGҗfkmaw{8㓬END'+k
CNWc$н.rPR@_%x*c]3% t:djʘ:"v?MWp-	!?:o2}/f\Wh!Kl |\:OE@dF!Dq#A@
u?o@00يҾCQz6nܶ6oMRZBuӛ؎["e~@00U00U#0tr<&wIS0[+O0M0K+0?http://rocsp-dgn.dgnservice.de:8080/ejbca/publicweb/status/ocsp0jU c0a0_++0O0M+Ahttp://www.dgnservice.de/trustcenter/public/dgnservice/index.html0U00ldap://ldap.dgnservice.de:389/CN=CRL-1,O=DGN%20Service%20GmbH,C=DE?certificateRevocationList?base?objectClass=cRLDistributionPoint0UƓdrj>TTy0U0	+m0
+m0
	*H
9ESj#55Gܩ
_EҮ"]+8F:
gV6}F+QOKW'B^DRtHxwcPO\a&J{yUdM//6n!:^
&6֗q&Chtjw;4A,+t8h{:|yl:+/6?4z1);݁ݻSjk-oǟp(IJ(ko1
100r0f10	UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PNU!`0
	`Hes0	*H
	1	*H
0	*H
	1
200826070429Z0/	*H
	1" E@@HI4\HWƳq!b0	+71t0r0f10	UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PNU!`0*H
	1tr0f10	UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PNU!`0
	*H
"O,N~3⹨X,k!tDqYJcY5k.4a%ȡb35ihT/&
D,ol-A>=58tNQ`qW	x4v1B]E}vc}
mlS2;*z}mq%B%1(san—B
kea~:c=
F,F3

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98370951-3D75-4B31-B7EE-D7578BB44D2E>