home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume09 / fixnew.src < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  3.4 KB

  1. From decwrl!wuarchive!cs.utexas.edu!samsung!uunet!allbery Sat Dec  2 19:52:31 PST 1989
  2. Article 1203 of comp.sources.misc:
  3. Path: decwrl!wuarchive!cs.utexas.edu!samsung!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v09i037: Submission:  fixnewsrc
  7. Message-ID: <72915@uunet.UU.NET>
  8. Date: 28 Nov 89 00:28:52 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: jeff@quark.wv.tek.com
  11. Organization: Tektronix Inc, Wilsonville, Or.
  12. Lines: 101
  13. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  14.  
  15. Posting-number: Volume 9, Issue 37
  16. Submitted-by: Jeff Beadles <jeff@quark.wv.tek.com>
  17. Archive-name: fixnewsrc
  18.  
  19. [ There is no makefile, or readme.  This is a short shell script, and there's
  20.   "README" information at the top.]
  21.  
  22. Description:
  23. This program will take the long lines created by rn in a .newsrc file,
  24. and shorten with them.  (mark all articles as read)
  25. It takes lines that look like this:
  26.  
  27.     talk.politics.misc! 1-1234,1235-19210,19212,19245-20322
  28.  
  29. and changes it to:
  30.  
  31.     talk.politics.misc! 1-20322
  32.  
  33. This helps, as if you try to use 'vi', it chokes on lines longer
  34. than 1024 characters or so.  Also, it probably speeds up the
  35. start-up time of rn.
  36.  
  37.  
  38.     -Jeff
  39. -- 
  40. Jeff Beadles        Tektronix Inc.
  41. jeff@quark.WV.TEK.COM
  42.  
  43.  
  44. #--------------------------------CUT HERE-------------------------------------
  45. #! /bin/sh
  46. #
  47. # This is a shell archive.  Save this into a file, edit it
  48. # and delete all lines above this comment.  Then give this
  49. # file to sh by executing the command "sh file".  The files
  50. # will be extracted into the current directory owned by
  51. # you with default permissions.
  52. #
  53. # The files contained herein are:
  54. #
  55. # -rwxr-xr-x  1 jeff         1296 Nov 26 16:55 fixnewsrc
  56. #
  57. echo 'x - fixnewsrc'
  58. if test -f fixnewsrc; then echo 'shar: not overwriting fixnewsrc'; else
  59. sed 's/^X//' << '________This_Is_The_END________' > fixnewsrc
  60. X#!/bin/sh
  61. X## Copyright 1989, Jeff Beadles.  Permission is granted to freely distribute.
  62. X## Submittor:    Jeff Beadles   jeff@quark.WV.TEK.COM
  63. X## Name:    fixnewsrc
  64. X## Date:    Sun Oct  1 09:25:33 PDT 1989
  65. X## Machine:    BSD Unix
  66. X## OS:        unix
  67. X## Version:    1.0
  68. X## Synopsis:    Fix long lines in .newsrc
  69. X##
  70. X## Description:
  71. X##
  72. X##    This program will take the long lines created by rn in a .newsrc
  73. X##    file, and shorten with them.  (mark all articles as read)
  74. X##    It takes lines that look like this:
  75. X##
  76. X##  talk.politics.misc! 1-1234,1235-19210,19212,19245-20322
  77. X##
  78. X##    and changes it to:
  79. X##
  80. X##  talk.politics.misc! 1-20322
  81. X##
  82. X##    This helps, as if you try to use 'vi', it chokes on lines longer
  83. X##    than 1024 characters or so.  Also, it probably speeds up the
  84. X##    start-up time of rn.
  85. X##
  86. X##    When done, a backup copy of .newsrc is saved in .newsrc.old
  87. X##
  88. X
  89. X## Change directory to the user's home directory
  90. Xcd
  91. X
  92. X## Check for a .newsrc file.
  93. Xif [ ! -f .newsrc ] ; then
  94. X    echo "$0: .newsrc not found."
  95. X    exit 1
  96. Xfi
  97. X
  98. X## Check for a .newsrc.old file, and remove if needed.
  99. Xif [ -f .newsrc.old ] ; then
  100. X    rm -f .newsrc.old
  101. Xfi
  102. X
  103. X## Make that backup first...
  104. Xcp .newsrc .newsrc.old
  105. X
  106. X## There is a space and a tab in the first two []'s below.
  107. Xsed '/!/s/^\([^     ][^     ]*\).*[,-][,-]*\([0-9][0-9]*\)$/\1 1-\2/' \
  108. X    < .newsrc.old > .newsrc
  109. Xexit 0
  110. ________This_Is_The_END________
  111. if test `wc -c < fixnewsrc` -ne 1296; then
  112.     echo 'shar: fixnewsrc was damaged during transit (should have been 1296 bytes)'
  113. fi
  114. fi        ; : end of overwriting check
  115. exit 0
  116.  
  117.  
  118.