Date: Wed, 26 Aug 2020 09:57:35 +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: <725F5FBC-A6EC-4694-8916-917B98872458@kukulies.org> In-Reply-To: <98370951-3D75-4B31-B7EE-D7578BB44D2E@kukulies.org> 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> <98370951-3D75-4B31-B7EE-D7578BB44D2E@kukulies.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
my solution:
$ sed 's/^\([A-Z0-9]*\)\(:*\)\([[:space:]]*\)\(DC[[:space:]]*[*][+]2\)/\1\2\3DC \1+2/' <el2
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
Thanks for helping.
—
Christoph
> Am 26.08.2020 um 09:04 schrieb Christoph Kukulies <kuku@kukulies.org>:
>
>
>
>> 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
`He 0 *H
00xU!`0
*H
0f10 UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PN0
200516152759Z
210516152759Z0o10 UDE1!0U400000005ec008dd373ad8ec10UChristoph 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]ǯpv 7030Uu ( ˗V6n 0U0 0U#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&SKRtF0d5
ڌ>מ ppّ;{_"+050UJf%0
*H
0a10 UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH10Udgnservice Root 7:PN0
161026092241Z
241026092241Z0f10 UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice 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ܶ6oMRZ Buӛ؎["e~@ 00U0 0U#0tr<&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 Udgnservice CA 2 Type E:PNU!`0
`He s0 *H
1 *H
0 *H
1
200826075735Z0/ *H
1" 2Bv$ B؉:4ƀ[0 +71t0r0f10 UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PNU!`0*H
1tr0f10 UDE1301U
*DGN Deutsches Gesundheitsnetz Service GmbH1"0 Udgnservice CA 2 Type E:PNU!`0
*H
"Y3HWBljȻ`kL@
?
fx&H(:{r}!C/:%Sjo3cS^C>@Y8)CBXЭCL`9N5Ֆ<Rx!Jٝ?!oRV>϶dk/PZGŢL(=khB#Moo3|~:rrJ n?Xf}B(I)4X%?;\):9WBRz>]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?725F5FBC-A6EC-4694-8916-917B98872458>
