sample.txt文件
2017-01-01 10:21:59 THURSDAY -39 3 Pick up a bus - Travel for two hours
2017-02-01 12:45:19 FRIDAY -55 8 Pick up a train - Travel for one hour
2017-03-01 11:35:49 SUNDAY -55 8 Pick up a train - Travel for one hour
I
.
.
当我执行建议的命令时,它被分为三个字段。
当我做下面的操作时,它没有按预期工作。
A = LOAD 'Sample.txt' USING PigStorage() as (line:chararray);
B = foreach A generate STRSPLIT(line, ' ', 3);
c = foreach B generate $2;
split C into buslog if $0 matches '.*bus*.', trainlog if $0 matches '.*train*.';
note:- dump 结果如下。
THURSDAY -39 3 Pick up a bus - Travel for two hours
FRIDAY -55 8 Pick up a train - Travel for one hour
SUNDAY -55 8 Pick up a train - Travel for one hour
要求:在上面的结果中,我想把火车和公共汽车分成两个关系,但它没有按预期发生
1条答案
按热度按时间yhxst69z1#
语法是
.*string.*
注意,它是.*
在绳子的两边。