On Fri, Jan 26, 2007 at 10:58:09AM +1100, Sonia Hamilton wrote: > Luke Yelavich wrote: > >Hi all > >I have been given a spreadsheet, which I have exported to a csv file, > >for use with a community website I am working on. > > > >I have a nasty problem, where a lot of the sells have massive amounts of > >whitespace. I am wondering whether there is a quick way to remove the > >whitespace, either in the spreadsheet, or in the csv file? I am guessing > >a regular expression could do it, but I am no regular expression expert. > > Sed is probably your friend here (though you could also try tr, awk, > perl, python, ...). > > I have a whole lot of sed links here [1], that lead off to sed > cheatsheets, etc. > > [1] http://www.snowfrog.net/?q=taxonomy/term/41
something like sed -e 's/ +/ /g' > newfile says something like find a space if there is atleast 1 more space (up to all the spaces) change that into 1 space. the difference between * and +. * would say 0 or more + is 1 or more > > -- > Sonia Hamilton. GPG key A8B77238. > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html >
signature.asc
Description: Digital signature
-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html