Find all files matching pattern in directory and copy subdirectories and files found

I have a directory structure of the following: $DIRECTORY/*.xml $DIRECTORY/*.others $DIRECTORY/subdir1/*.xml $DIRECTORY/subdir1/*.others $DIRECTORY/subdir2/*.xml $DIRECTORY/subdir2/*.others And wish to copy all xml files into $OUTPUT_DIRECTORY including the directory structure of $DIRECTORY so the result will be: $OUTPUT_DIRECTORY/*.xml $OUTPUT_DIRECTORY/subdir1/*.xml $OUTPUT_DIRECTORY/subdir2/*.xml I know find has both -exec and -execdir which will use the output of find as the arguments… Read More Find all files matching pattern in directory and copy subdirectories and files found

I just want to sort my words from array alphabetically by 1st letter and then by 2nd letter according to my given pattern which matched by 1st letter

♦ pattern: e,b,c,d,i,f,g,h,o,j,k,l,m,n,u,p,q,r,s,t,a,v,w,x,y,z I want to sort my words from arr alphabetically by 1st letter and then by 2nd letter of a similar word matched by 1st letter according to my given pattern. [‘aobcdh’, ‘aibcdh’, ‘aabcdh’, ‘aacbdh’, ‘cfghjd’, ‘cighjd’] ♦ output should be: [‘aibcdh’, ‘aobcdh’, ‘aabcdh’, ‘aacbdh’, ‘cighjd’, ‘cfghjd’ ] ♦ or: aibcdh aobcdh aabcdh… Read More I just want to sort my words from array alphabetically by 1st letter and then by 2nd letter according to my given pattern which matched by 1st letter