home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume9 / fixnewsrc < prev    next >
Text File  |  1989-11-27  |  3KB  |  108 lines

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