home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / bin / xfiles < prev   
Encoding:
Text File  |  1990-01-19  |  594 b   |  31 lines

  1. #!/bin/sh
  2. #         move files
  3. # Usage:
  4. # xfiles command filekey (execute command on files greped by filekey.
  5. # xfiles command filekey1 filekey2 (execute command 
  6. #    on files greped by a filekey1 and those
  7. #    with a filekey1 replaced by filekey2
  8. # Example: xfiles mv .c .c.old
  9. # Bug: Proven to work only in the current directory
  10. #
  11. ls *$2* | if test $3 
  12. then awk ' { print $0 " " $0 } ' > /tmp/$$.xfiles
  13. ed /tmp/$$.xfiles <<+
  14. 1,\$s/$2/xxyyzz/
  15. w
  16. 1,\$s/$2/$3/
  17. w
  18. 1,\$s/xxyyzz/$2/
  19. w
  20. 1,\$s/^/$1 /
  21. w
  22. +
  23. else cat > /tmp/$$.xfiles
  24. ed /tmp/$$.xfiles <<+
  25. 1,\$s/^/$1 /
  26. w
  27. +
  28. fi
  29. cat /tmp/$$.xfiles 
  30. sh /tmp/$$.xfiles 
  31.