Page 1 of 1

Replace characters in csv file

Posted: Sat Mar 26, 2011 12:43 pm
by rice1973
Hi Oleg,I have a csv (text file) with 30 columns. Now i want to change certain characters in column 29. "space" has to be replaced by "_" and all upper characters have to be made lower case. Fields are devided by "," and fields are starting and ending with """ .Example;"nice","is","this", "text line","This One"has to become;"nice","is","this", "text line","this_one"So replacements have to be done in one column and not complete csv.Please advice.Best regards,Maurice

Replace characters in csv file

Posted: Mon Mar 28, 2011 6:13 pm
by Oleg
Suppose you set the value into variable MyVar

Take the 29-th column {MyVar(29)} and replace the spaces with "_" character (STR replace action) and set it to new variable NewField. Also you can do uppercase and lowercase the string (see system variables Uppercase and Lowercase)

Next, you can compose new string:
"{MyVar(0)}","{MyVar(1)}","{MyVar(2)}",.....,"{MyVar(28)}"," {LowerCase({NewField})}"