Guest User

Untitled

a guest
Jun 25th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. 00802_Bla_Aquarium_00020.jpg <= this one
  2. 00802_Bla_Aquarium_00021.jpg
  3. 00802_Bla_Aquarium_00022.jpg
  4. 00802_Bla_Aquarium_00023.jpg
  5. 00802_Bla_Aquarium_00024.jpg <= this one
  6. 00802_Bla_Aquarium_00025.jpg
  7. 00802_Bla_Aquarium_00026.jpg
  8. 00802_Bla_Aquarium_00027.jpg
  9. 00802_Bla_Aquarium_00028.jpg <= this one
  10. 00802_Bla_Aquarium_00029.jpg
  11.  
  12. n=0; cp 00802_Bla_Aquarium_?????.jpg(^e:'((n++%4))':) /some/place
  13.  
  14. # put the file list in the positional parameters ($1, $2...).
  15. # the files are sorted in alphanumeric order by the shell globbing
  16. set -- 00802_Bla_Aquarium_?????.jpg
  17.  
  18. n=0
  19. # loop through the files, increasing a counter at each iteration.
  20. for i do
  21. # every 4th iteration, append the current file to the end of the list
  22. [ "$(($n % 4))" -eq 0 ] && set -- "$@" "$i"
  23.  
  24. # and pop the current file from the head of the list
  25. shift
  26. n=$(($n + 1))
  27. done
  28.  
  29. # now "$@" contains the files that have been appended.
  30. cp -- "$@" /some/place
  31.  
  32. cp $(printf '%sn' 00802_Bla_Aquarium_?????.jpg | awk 'NR%4 == 1') /some/place
  33.  
  34. cp 00802_Bla_Aquarium_*{00..99..4}.jpg selected
  35.  
  36. n=0
  37. for file in ./*.jpg; do
  38. test $n -eq 0 && cp "$file" selected/
  39. n=$((n+1))
  40. n=$((n%4))
  41. done
  42.  
  43. find . -maxdepth 1 -name "*.jpg" | sort | while IFS= read -r file; do
  44. cp "$file" selected/
  45. IFS= read -r; IFS= read -r; IFS= read -r
  46. done
Add Comment
Please, Sign In to add comment