🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #54260

Re: slrn/slrnpull - CR/LF at end of line

#54260
From: Sylvan Butler
Date: Thu, 18 Nov 1999 00:00
41 lines
2632 bytes
On Thu, 18 Nov 1999 16:07:15 GMT, Tomasz Tatar <tatar@comarch.pl> wrote:
>Sylvan Butler wrote:
>>I'd recommend using linux to simply strip the CR from the line endings.
>>This might be as simple as "tr -d '\r'" (but that will remove every CR,
>>not just those on line endings...  usually you will be fine with that).
>>
>But tr has to be run for each file and moreover with redirecting to
>other file and changing name. When getting 1000 or more articles,

Or redirecting to a temporary file and moving the result back to replace
the original if it succeeds.

>it's a bit confusing. Does exist something like tr or sed, but working
>on multiple files (tr * or (better) tr news/* news/*/* news/*/*/* or (best)
>tr -R news)? Maybe find -exec? But it's still a bit complicated...

That's what scripts are for.  Something like:

tr-news-article:
    #!/bin/bash
    echo "Processing $1"
    tr -d '\r' < $1 > /tmp/tr.$$ && mv -f /tmp/tr.$$ $1

called by (possibly in another script):
   find news -type f -exec tr-news-article \{\} \;

(I wrote all that on the fly with no testing.  YMMV)

If you keep older articles in the tree, you may want to add some
date/time checking into find as an optimization to prevent processing
the same articles multiple times.

sdb
-- 
 | Sylvan Butler | Not speaking for Hewlett-Packard | sbutler-boi.hp.com |
 | Watch out for my e-mail address. Thank UCE.   #### change ^ to @ #### |
    They that can give up essential liberty to obtain a little temporary
    safety deserve neither liberty nor safety. --Benjamin Franklin, 1759
 "Don't Tread On Me!"

Technical Details
Message-ID: <slrn838r8u.bpi.nospam+_no_Zs__9911@hpb13799z.zboi.hpz.com.invalid>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
References: <uavY3.37002$jG2.750747@news.tpnet.pl> <slrn835o6n.71n.nospam+_no_Zs__9911@hpb13799z.zboi.hpz.com.invalid> <TuVY3.883$_3.20289@news.tpnet.pl>

Show Full Headers
Complete Article Headers
Message-ID: <slrn838r8u.bpi.nospam+_no_Zs__9911@hpb13799z.zboi.hpz.com.invalid>
Subject: Re: slrn/slrnpull - CR/LF at end of line
Date: Thu, 18 Nov 1999 00:00:00 +0000
From: nospam+_no_Zs__9911@hpb13799z.zboi.hpz.com.invalid (Sylvan Butler)
References: <uavY3.37002$jG2.750747@news.tpnet.pl> <slrn835o6n.71n.nospam+_no_Zs__9911@hpb13799z.zboi.hpz.com.invalid> <TuVY3.883$_3.20289@news.tpnet.pl>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 550279015
X-Original-NNTP-Posting-Host: hpb13799.boi.hp.com
Mail-Copies-To: never
X-Complaints-To: usenet@news.boi.hp.com
X-Trace: hpbs1500.boi.hp.com 942960314 25939 15.98.137.41 (18 Nov 1999 21:25:14 GMT)
Organization: Hewlett-Packard
User-Agent: slrn/0.9.5.7 (Linux)
NNTP-Posting-Date: 18 Nov 1999 21:25:14 GMT
Newsgroups: news.software.readers