fork download
  1. #!/bin/bash
  2. s="Text... f[3][2,3][4] ...text"
  3. sed -E 's/(f\[[0-9]*]\[[0-9]*,[0-9]*])\[([0-9]*)]/\1["string"][\2]/g' <<< "$s"
Success #stdin #stdout 0s 19632KB
stdin
Standard input is empty
stdout
Text... f[3][2,3]["string"][4] ...text