DEV Community

Discussion on: Daily Challenge #37 - Name Swap

Collapse
 
moopet profile image
Ben Sinclair

I think I may have gone overboard with the ol' backslashes for escaping, but...

sed 's/\s*\([^ ]\+\)\s\+\([^ ]\+\)\s*/\2 \1/' <<<"  Emma McClean"
Enter fullscreen mode Exit fullscreen mode