fork download
  1. #!/bin/bash
  2. s=':account_id:12345:6789:Melbourne:Aus
  3. :account_id:98765:43210:Adelaide:Aus
  4. :customer_id:98765:43210:Adelaide:Aus'
  5.  
  6. perl -pe 's~^(?:[^:]*:){2}(*SKIP)(?!)|:~~g if /^:account_id:/' <<< "$s"
Success #stdin #stdout 0.01s 5520KB
stdin
Standard input is empty
stdout
:account_id:123456789MelbourneAus
:account_id:9876543210AdelaideAus
:customer_id:98765:43210:Adelaide:Aus