home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / sco / scripts / fix_newsrc < prev    next >
Encoding:
Text File  |  1997-08-26  |  794 b   |  30 lines

  1. :
  2. # fix_newsrc: consolidate ranges in .newsrc
  3. # @(#) fix_newsrc.sh 1.0 97/04/28
  4. # 92/08/10 john h. dubois iii (john@armory.com)
  5. # 92/09/26 Added help.
  6.  
  7. if [ $# -gt 0 ]; then
  8.     echo \
  9. "$0: consolidate message ranges in .newsrc
  10. Each line in .newsrc is read and the ranges of read messages given on
  11. the line are replaced with a single range which extends from the first
  12. message number on the line to the last message number on the line.
  13. The old .newsrc is moved to .newsrc- and is repaced by the new .newsrc"
  14.     exit
  15. fi
  16.  
  17. cd $HOME
  18. cp .newsrc .newsrc-
  19.  
  20. # use gawk for its lack of a line-length limit
  21. gawk '
  22. {
  23.     # Lines without spaces seem to occasionally be put in .newsrc,
  24.     # so do not depend on them.
  25.     sub(":.*[-,]",": 1-")
  26.     sub("!.*[-,]","! 1-")
  27.     print $0
  28. }
  29. ' .newsrc- > .newsrc
  30.