Replace all multi-blankspaces (more than one spaces/tabs) in file with mono-blankspace (one space):
sed 's/[<space>][<tab>][<space>][<tab>]*/ /g' filename
can also be:
sed 's/[<space>][<tab>][<space>][<tab>]*/ /g' filename > newfilename
note: g in the end means GLOBAL
In the above samples, <space> means ‘ ‘ (empty space) and <tab> means ‘ ‘ (tab key press).
This entry was posted by redoer on 24/01/2017 at 7:07 am, and is filed under howto, linux, sed, tipsNtricks. Follow any responses to this post through RSS 2.0.
Both comments and pings are currently closed.
Comments are closed.