Date: Tue, 25 Aug 2020 22:00:54 +0200 From: Christoph Kukulies <kuku@kukulies.org> To: Ruben via freebsd-questions <freebsd-questions@freebsd.org> Subject: Sed pattern help - not FreeBSD related Message-ID: <6B02E882-D3EE-4721-B572-BFAF5C6BAC66@kukulies.org>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Excuses for asking a sed problem only without relation to FreeBSD:
I have a file el2 with the following content:
LOOP: DC *+2
DO: DC *+2
J: DC *+2
ENCL: DC *+2 PDP-11 VERSION OF ENCLOSE
KEY DC *+2
EMIT DC *+2
QTERM DC *+2
With a sed command I will make it become:
LOOP: DC LOOP+2
DO: DO+2
J: J+2
ENCL: ENCL+2 PDP-11 VERSION OF ENCLOSE
KEY KEY+2
EMIT EMIT+2
QTERM QTERM+2
In other words, the "*" should be replaced by the label in front of the line.
In case the line contains something after "+2“ (a comment), it should be appended.
The following sed command doesn’t work. Please no awk,perl,python or other script :)
$ sed 's/\(^[A-Z0-9]*\)\(:?\)\([ \t]*\)\(DC \*\+2\)\(.*$\)/\1\2\3DC \1+2/\5’ <el2
Thanks in advance,
—
Christoph
[-- 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
200825200054Z0/ *H
1" uVc{KLNɌ*wwtouO0 +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
M3a
I
U
"ܽ2bG 9[ ,2{A/$io7?
MNS`IYɔir؋ngvJD 4pHZU0)¿sQWN*w~k^sTNz_|R3pU[+o{ ڷӀ"D-'e
WtѲH^qto.Tjs'#[x;q梷V#HYXMk,!tzMr
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6B02E882-D3EE-4721-B572-BFAF5C6BAC66>
