Sed pattern help - not FreeBSD related

Tim Daneliuk tundra at tundraware.com
Tue Aug 25 22:46:05 UTC 2020


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}'

-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the freebsd-questions mailing list