Hi Andrew, Thanks a lot that is exactly what I was looking for.
Greets, -Marco On Tue, Oct 11, 2011 at 9:58 AM, Andrew Clegg <[email protected] > wrote: > Try: > > foreach A generate (name == 'John' ? 'Marco' : name) as name; > > or for multiple: > > foreach A generate > (name == 'John' ? 'Marco' : > (name == 'Sally' ? 'Anne' : name)) as name; > > Maybe there's a better way if you have to do lots of these at once..? > > See also REPLACE for replacing a substring. > > On 11 October 2011 08:51, Marco Cadetg <[email protected]> wrote: > > Hi there, > > > > I would like to replace the value of a field based on its value. E.g.: > > > > A = LOAD 'student' USING PigStorage() AS (name:chararray); > > DUMP A; > > (John) > > (Mary > > (Bill) > > (Joe) > > (John) > > > > Now I would like to replace all John's with Marco. Is there a way to do > this > > in PIG? I thought about using sth like SPLIT IF John and then union the > > result again. Is there a better way? > > > > Cheers > > -Marco > > > > > > -- > > http://tinyurl.com/andrew-clegg-linkedin | http://twitter.com/andrew_clegg >
