I am facing this problem a lot. For eg.
a b c d abcd
x y z w xyzw
Now i have to remove the spaces between only the single characters. The lines have some characters in front as well.
i want to try something like this: s/[a-z] [a-z]/[a-z] [a-z]/g - what could be possible replace expression?
This is just an example of the problem. I face similar issues a lot of time when i have to apply some search to find these type of expression and replace to an expression but not replace them fully and only replace a part of it.
Edit: Want to remove single space between single characters.
Use a regular expression with collections of substrings:
s/\([a-z]\) \([a-z]\)/\1\2/g
the \1 refers to the characters matched by the regular expression between the first \(...\), and \2 the characters matched by the regular expression between the second \(...\)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With