March 18

Sed: reduce multiple spaces to single space

sed ’s/[ t]+/ /g’ input-file

or

echo “Some    random   text.   🙂 ” | sed ’s/[ t]+/ /g’

You have no idea how often I forget this useful snippet. 😀

Tags: ,
Copyright 2021. All rights reserved.

Posted March 18, 2010 by admin in category "Top of my head

Leave a Reply

Your email address will not be published. Required fields are marked *