Search code examples
hadoopooziedistcp

regexp in oozie distcp action


I am trying to copy all files that fit certain criteria into a folder

  <action name="copy_mta_c">
    <distcp xmlns="uri:oozie:distcp-action:0.2">
      <arg>${NAME_NODE}${PATH_COMVERSE}${CURRENT_DATE_NO_DASH}_*/*mta.gz</arg>
      <arg>${NAME_NODE}${PATH_MTA}/</arg>
    </distcp>
    <ok to="copy_mta_y"/>
    <error to="KILL"/>
  </action>

Here symbol * in ${CURRENT_DATE_NO_DASH}_* stands for A or B or C etc. It searches for all folders. If I use ${CURRENT_DATE_NO_DASH}_A it will only search 1 filder. How can I make it take only 2 out of all folders? I tried doing (A|B), but this didn't work.


Solution

  • I'm assuming this will be a bash expansion since your variables look like bash variables.

    You can use this:

    ${CURRENT_DATE_NO_DASH}_[A-C]
    

    Or this:

    ${CURRENT_DATE_NO_DASH}_{A,B,C}