Bug: csvfix edit can't match empty strings

78 views
Skip to first unread message

Giacecco

unread,
Jun 27, 2015, 6:12:38 AM6/27/15
to csv...@googlegroups.com
See this example CSV:

"2003-02-21 00:00","UB5 4PJ","106","","READING ROAD","NORTHOLT","NORTHOLT","EALING","GREATER LONDON"
"2005-07-15 00:00","","58","","ADAMS MEADOW","ILMINSTER","ILMINSTER","SOUTH SOMERSET","SOMERSET"
"2010-09-10 00:00","W4 1DZ","58","","WHELLOCK ROAD","","LONDON","EALING","GREATER LONDON"

If I run csvfix edit -f 2 -e "s/^$/foo/g" nothing happens! If it worked, this would be very useful to initialise empty columns to some default value. Thanks,

Giacecco

Neil Butterworth

unread,
Jun 27, 2015, 8:52:32 AM6/27/15
to csv...@googlegroups.com, gianfranc...@digitalcontraptionsimaginarium.co.uk
This is actually a bug with the "g" option of the "s" edit command - this should work:


       csvfix edit -f 2 -e "s/^$/foo/"

marcde...@gmail.com

unread,
Nov 2, 2016, 2:19:50 PM11/2/16
to csvfix, gianfranc...@digitalcontraptionsimaginarium.co.uk
Hi Neil,

do you plan to fix this bug or shall we use your solution command?
Actually, I'm not sure if this is a real bug since global substitutions
for <starts with> instructions seem a little bit strange to me.

Thank you.
Reply all
Reply to author
Forward
0 new messages