I'm trying to replace the tab with 4 spaces, using sed, but it is not working.
Here is my code:
sed -i '{s/\t/ \{4\}/g}' filename
Any suggestion is appreciate.
In sed
replacement is not supposed to be a regex, so use:
sed -i.bak $'s/\t/ /g' filename
On gnu-sed even this will work:
sed -i.bak 's/\t/ /g' filename
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