[Nottingham] Is everyone "sed -e 's/.../.../ ...'" only?

Martin martin at ml1.co.uk
Tue Aug 1 16:46:12 UTC 2017


On 01/08/17 15:48, Martin via Nottingham wrote:
> Folks,
> 
> All in a day's bash-ing and...
> 
> Does anyone commonly use sed with anything other than just the "s"
> (substitute) command?

And just for one trivial example:


Converting json -> csv on the commandline to untangle the syntax:

sed -re 's/^[[:space:]]*\{//; s/":"/","/g; s/":null/",null/g;
s/\}[[:space:]]*$/\n/'


And yes, there's jq and python tools and I'm sure many others... But sed
is easy enough for a trivial single level of key:values pairs...


OK... So how many lightweight ways might there be for that?

Dare I ask what might be the most heavyweight?! ;-)


Cheers,
Martin


-- 
- ╔═══════════════════╦══════════════════════════════════════════╗
- ║   Martin Lomas    ║ OpenPGP (GPG/PGP) Public Key: 0xCEE1D3B7 ║
- ║ martin@ ml1 co uk ║ Import from   hkp://subkeys.pgp.net   or ║
- ║ ----------------- ║ http:// ml1 .co .uk/martin_ml1_co_uk.gpg ║
- ╚═══════════════════╩══════════════════════════════════════════╝



More information about the Nottingham mailing list