2017-07-06 112 views
1

我用逗號(,)分隔(csv)數據集。每個分隔符後面有一個空格,我想在Pig腳本中刪除。例如排的樣子:使用PIG刪除空格

"Sachin", "India", "batsaman", "99", "kolkata", " ", "xyz" 

逗號後移除空格之後,它應該是這樣的:

"Sachin","India","batsaman","99","kolkata"," ","xyz" 

回答

1

加載到一個單一的領域,並使用REPLACE。

A = LOAD 'data.txt' USING TextLoader(); 
B = FOREACH A GENERATE REPLACE($0,' ','');