Quantcast
Channel: How to match whitespace in sed? - Super User
Browsing all 7 articles
Browse latest View live

Answer by Bünyamin C. for How to match whitespace in sed?

I don't know if it can help but I just did that :MacBook-Pro-van-User:training user$ cat sed.txtMy name is BobMacBook-Pro-van-User:training user$sed s/"My name is Bob"/"My Lastname is Montoya"/g...

View Article



Answer by user1932365 for How to match whitespace in sed?

None of the above worked for me. Yet I found the simplest answer ever by using awkuser@~[]$ cat /tmp/file/nospace/in/here/this/one space/well/seems we have spacesuser@~[]$ cat /tmp/file |awk...

View Article

Answer by Zac for How to match whitespace in sed?

sed 's/[ \t]*/"space or tab"/'

View Article

Answer by some ideas for How to match whitespace in sed?

This works on MacOS 10.8:sed -E "s/[[:space:]]+/ /g"

View Article

Answer by Marnix A. van Ammers for How to match whitespace in sed?

Some older versions of sed may not recognize \s as a white space matching token. In that case you can match a sequence of one or more spaces and tabs with '[XZ][XZ]*' where X is a space and Z is a tab.

View Article


Answer by mrucci for How to match whitespace in sed?

The character class \s will match the whitespace characters <tab> and <space>.For example:$ sed -e "s/\s\{3,\}/ /g" inputFilewill substitute every sequence of at least 3 whitespaces with...

View Article

How to match whitespace in sed?

How can I match whitespace in sed? In my data I want to match all of 3+ subsequent whitespace characters (tab space) and replace them by 2 spaces. How can this be done?

View Article
Browsing all 7 articles
Browse latest View live


Latest Images