I am trying to get the partition column names of a hive table in bash using grep and regex. I am trying this:
hive -e 'show create table employees' | grep -E 'PARTITIONED BY (.*)'
This is giving me the result like: PARTITIONED BY (
How do I have to modify my command to grab this part:
PARTITIONED BY (
year char(4),
month char(2))
The end goal for me is to grab all the partition columns into variables or array so that I can use them later. If there is a better way to achieve what I am trying to do, I am open to that as well.
Any help would be appreciated.
Thank you.