fork download
  1. #!/bin/bash
  2. s="12345, a string of random length, another string of random length, 2019-01-01
  3. 12346, more a string of random length, other string of random length, 2019-01-01"
  4. sed "s/[[:alpha:]]\([[:alpha:][:space:]]*[[:alpha:]]\)\{0,1\}/'&'/g" <<< "$s"
  5. sed -E "s/[[:alpha:]]([[:alpha:][:space:]]*[[:alpha:]])?/'&'/g" <<< "$s"
Success #stdin #stdout 0s 4512KB
stdin
Standard input is empty
stdout
12345, 'a string of random length', 'another string of random length', 2019-01-01
12346, 'more a string of random length', 'other string of random length', 2019-01-01
12345, 'a string of random length', 'another string of random length', 2019-01-01
12346, 'more a string of random length', 'other string of random length', 2019-01-01