-1

I am trying to extract only the second word in a string. For example

Name[Column Name]
Patrick_Andrew_Marsh
Rajesh_Kumar_Sinha

I want to extract Andrew and Kumar from the column and similarly for all the other names. How do I do it?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • http://hadooptutorial.info/string-functions-in-hive/ – Nathan_Sav Mar 21 '22 at 10:55
  • 1
    Does this answer your question? [Does Hive have a String split function?](https://stackoverflow.com/questions/4065999/does-hive-have-a-string-split-function) – yivi Mar 21 '22 at 13:41

1 Answers1

0

You can use the split function for this purpose

 select split(name, '_')[1]  from table
emrdev
  • 2,155
  • 3
  • 9
  • 15