Created 10-11-2022 11:48 PM
i got a bunch of files with differert headers
for files of one type,their may be two kinds of headers,i.e. the following two type(call it type1 and type 2) of files's headers
type1: a,b,c34,d or a,b,c,d
type2: d,e,f,kgg or d,e,f,g
notice that the third field names of type1 are c or c34,the forth field names of type2 are kgg or g,the field name c34 and kgg are wrong, and need to be changed to c and g
i want to change the headers only(that is, the first line) using kv pairs, key is the string to be replaced and value is the replacement value ,such as
{"c34":"c"
"kgg":"g"
"hqq":"h"
....
}
i want to do this using replacetext but the processor replacetext could only set one search and replacement value,that's the problem!!
any ideas would be welcome
Created 10-12-2022 03:18 AM
Perhaps JoltTransformRecord could help you.
The jolt transformation "shift" let's you rename fields - in a csv file's case, headers.
If you know all your replaces ahead of time, you could define a transformation like:
{
operation: shift
spec: {
"kgg":"g",
"c34":"c",
"*":"&"
}
}
Note the last shift, "*":"&" , which would transfer over the rest of the headers you didn't specifically rename.
Created 10-12-2022 03:18 AM
Perhaps JoltTransformRecord could help you.
The jolt transformation "shift" let's you rename fields - in a csv file's case, headers.
If you know all your replaces ahead of time, you could define a transformation like:
{
operation: shift
spec: {
"kgg":"g",
"c34":"c",
"*":"&"
}
}
Note the last shift, "*":"&" , which would transfer over the rest of the headers you didn't specifically rename.
Created 10-13-2022 03:39 AM
thanks ! that's a good idea
i'll have a try
Created 10-14-2022 02:07 AM
thanks ,Green!
your idea helped me solve the problem