Sed pattern help - not FreeBSD related

Manish Jain bourne.identity at hotmail.com
Tue Aug 25 20:32:31 UTC 2020



On 2020-08-26 01:30, Christoph Kukulies wrote:
> 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
> 
> 

There appears a problem in the LOOP line below.

> 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


Hi Christoph,

I think the LOOP line is wrong : perhaps, you meant

 > LOOP:   LOOP+2

If that is so, you can use the following command :

sed 's/^\(..*\):\([[:space:]]*\)DC[[:space:]]*\*/\1:\2\1/' <file>


Regards,
Manish Jain


More information about the freebsd-questions mailing list