remove white space before delimiter with sed
Posted
by
Erik
on Super User
See other posts from Super User
or by Erik
Published on 2012-10-22T04:45:18Z
Indexed on
2012/10/22
5:05 UTC
Read the original article
Hit count: 203
sed
I have data of the following format that I want to input into LibreOffice calc
data | num | num | num | num
For some reason Libreoffice does not think the string "3214 " is a number by default (trailing white space).
I want to replace '(\s)*|' with '|' where \s stands for space and * for the Kleene star operation. And do this at multiple places in each line (all matches).
I tried:
sed -i 's/(\s)*|/|/' DataStats0914.txt
But it has no effect.
© Super User or respective owner