i want split string area conversion.i have data this.
(149sq.yards) (151sq.yards) (190sq.yards) (190sq.yards)
i want split the above data this.
149 sq.yards 151 sq.yards
i tried following code.
a = load '/user/ahmedabad/makkan_propertydetails_apartment_ahmedabad.csv' using pigstorage('\t') (sourcewebsite:chararray,propertyid:chararray,listedon:chararray,contactname:chararray,totalviews:int,price:chararray,priceperarea:chararray,noofbedrooms:int,noofbathrooms:int,floornoofproperty:chararray,totalfloors:int,possession:chararray,builtuparea:chararray,furnished:chararray,ownership:chararray,newresale:chararray,facing:chararray,title:chararray,propertyaddress:chararray,nearbyfacilities:chararray,propertyfeatures:chararray,sellerinfo:chararray,description:chararray); b = foreach generate builtuparea; c = filter b (builtuparea matches '.*sq.yards.*'); d = foreach c generate (bigdecimal) regex_extract(builtuparea,'(.*)', 1) * 9;
while dump d .it prints null.
the regex mentioned match characters, try multiply (149sq.yards * 9)
. reason null in output.
the below regex split numbers alone input , multiply (149 * 9)
.
d = foreach c generate (bigdecimal) regex_extract(builtuparea,'(^[0-9]+)', 1) * 9; dump d;