Cut substring from a field?

23 views
Skip to first unread message

marcde...@gmail.com

unread,
Oct 29, 2016, 1:04:48 PM10/29/16
to csvfix
Is it possible to cut a substring from a field,
e.g. substring 1 to 3 from field 2?

Please excuse if the answer is listed in the
help file, I haven't read every topic yet.

Thank you.

Neil Butterworth

unread,
Oct 29, 2016, 1:10:31 PM10/29/16
to csvfix
Yes, use the  substr() function in the expression language with commands like eval. See http://neilb.bitbucket.org/csvfix/manual/csvfix16/ExpressionLanguage.html

In your case this would be the call to use:

         substr( $2, 1, 3 )

marcde...@gmail.com

unread,
Oct 29, 2016, 2:52:20 PM10/29/16
to csvfix
Hi Neil,

great, thank you very much. I have done it successfully with csvfix eval -e "substr($2,1,3)"

Regards,
Marc
Reply all
Reply to author
Forward
0 new messages