Bash rename example of rename:sed/find command

From , 3 Years ago, written in PowerShell, viewed 103 times.
URL https://pastebin.vip/view/faa98789
  1. #!/bin/sh
  2.  
  3. HANDLE_DIR=`pwd`
  4.  
  5. for file1 in `find $HANDLE_DIR -name "output*.bin" -exec basename {} \;`
  6. do
  7.         mv -f $file1 `echo $file1 | sed -e "s/\./.0./g"`
  8. done
  9.  
  10. for file2 in `find $HANDLE_DIR -name "output*.bin.*" -exec basename {} \;`
  11. do
  12.         num=`echo $file2 | awk -F. '{print $3}'`
  13.         mv -f $file2 `echo $file2 | sed -e "s/\./.$num./" -e "s/bin.*/bin/"`
  14. done
  15. //shell/792

Reply to "Bash rename example of rename:sed/find command"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website