Quick Command – replacing camelcase with underscore

Technical

sed 's/\([A-Z]\)/_\l\1/g' file.txt | sed 's/^_\([a-z]\)/\1/g'

Example:

user@M0096:~$ cat file.txt
oneTwoThreeFour
oneTwo
one
FourThreeTwo
user@M0096:~$ sed 's/\([A-Z]\)/_\l\1/g' file.txt | sed 's/^_\([a-z]\)/\1/g'
one_two_three_four
one_two
one
four_three_two