SyntaxFix
Write A Post
Hire A Developer
Questions
This worked for me using sed [Edit: comment below points out sed doesn't support \s]
[^ ]
while
[^\s]
didn't
# Delete everything except space and 'g' echo "ghai ghai" | sed "s/[^\sg]//g" gg echo "ghai ghai" | sed "s/[^ g]//g" g g