Skip to content

Instantly share code, notes, and snippets.

@sylvainraye
Last active December 22, 2015 23:58
Show Gist options
  • Save sylvainraye/6550115 to your computer and use it in GitHub Desktop.
Save sylvainraye/6550115 to your computer and use it in GitHub Desktop.
Awk command for diff and copy file
# do an echo only of the result
diff -x "CVS" -x '.svn*' -bqr originaux/magento17/include/ myproject/include/ | grep "Only in originaux" | awk '{gsub(":", "", $3); filesource=$3"/"$4; print filesource; gsub("originaux/magento17/", "myproject/", $3); filetarget=$3"/"$4; print filesource" - "filetarget; }'
# do the copy
diff -x "CVS" -x '.svn*' -bqr originaux/magento17/include/ myproject/include/ | grep "Only in originaux" | awk '{gsub(":", "", $3); filesource=$3"/"$4; print filesource; gsub("originaux/magento17/", "myproject/", $3); filetarget=$3"/"$4; system ("cp -R "filesource" "filetarget); }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment