How to split camel or pascal case in bash

Sometime you get names like “helloMyNameIsFrank” (Camel case) or “HelloMyNameIsFrank” (Pascal case) and you want to make them human readable.

In bash you can use

sed 's/\([A-Z]\)/ \1/g'

Example

$ text="helloMyNameIsFrank"
$echo $text | sed 's/\([A-Z]\)/ \1/g'
hello My Name Is Frank
comments powered by Disqus