Article View: news.software.nntp
Article #83811Re: docheckgroups et al
From: Russ Allbery
Date: Fri, 07 Jan 2011 02:25
Date: Fri, 07 Jan 2011 02:25
30 lines
2528 bytes
2528 bytes
Julien ΓLIE <iulius@nom-de-mon-site.com.invalid> writes:
> I have just made a new version (still not committed) which seems to
> work fine.
> Example of changes:
> BEFORE:
> cat | ${AWK} '{ if ($1 !~ /'"${2:-^#}"'/ && $1) { print $0 } }' >${T}/$$msg
> NOW:
> cat | ${PERL} -e 'while (<STDIN>) { my @fields = split();
> print $_ if ((scalar(@fields) > 0) && ($fields[0] !~ /'${2:-^#}'/)
> && ($fields[0] !~ /^#/)); }' > ${T}/$$msg
Hm, the mix of shell and Perl still makes this kind of hard to follow and
read. Have you considered rewriting the whole script in Perl?
(You do need the "" around the $2 parameter, in case it contains shell
metacharacters. There are a few other places like that as well.)
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID:
<871v4p78mh.fsf@windlord.stanford.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed101.telia.com!starscream.dk.telia.net!news.tele.dk!news.tele.dk!small.news.tele.dk!usenet.stanford.edu!usenet-its.stanford.edu!not-for-mailReferences:
<ie88v7$hg8$1@n102.xanadu-bbs.net> <ifb38e$2m6$1@puck.litech.org> <ifcmdj$h2p$1@n102.xanadu-bbs.net> <87ipydiwys.fsf@windlord.stanford.edu> <ifri8f$4jg$1@puck.litech.org> <ifs1r4$rjh$1@n102.xanadu-bbs.net> <8oejprF38fU1@mid.individual.net> <ifth0a$92v$1@n102.xanadu-bbs.net> <8of2b7FqphU1@mid.individual.net> <ifvkrk$tqg$1@n102.xanadu-bbs.net> <87r5csmuwk.fsf@windlord.stanford.edu> <ig05m5$2ij$1@n102.xanadu-bbs.net> <8ok9csFl0pU1@mid.individual.net> <878vyzvssp.fsf@windlord.stanford.edu> <8omulnFbgoU1@mid.individual.net>Show Full Headers
Complete Article Headers
Message-ID: <871v4p78mh.fsf@windlord.stanford.edu> Subject: Re: docheckgroups et al Date: Thu, 06 Jan 2011 18:25:26 -0800 From: Russ Allbery <rra@stanford.edu> References: <ie88v7$hg8$1@n102.xanadu-bbs.net> <ifb38e$2m6$1@puck.litech.org> <ifcmdj$h2p$1@n102.xanadu-bbs.net> <87ipydiwys.fsf@windlord.stanford.edu> <ifri8f$4jg$1@puck.litech.org> <ifs1r4$rjh$1@n102.xanadu-bbs.net> <8oejprF38fU1@mid.individual.net> <ifth0a$92v$1@n102.xanadu-bbs.net> <8of2b7FqphU1@mid.individual.net> <ifvkrk$tqg$1@n102.xanadu-bbs.net> <87r5csmuwk.fsf@windlord.stanford.edu> <ig05m5$2ij$1@n102.xanadu-bbs.net> <8ok9csFl0pU1@mid.individual.net> <878vyzvssp.fsf@windlord.stanford.edu> <8omulnFbgoU1@mid.individual.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed101.telia.com!starscream.dk.telia.net!news.tele.dk!news.tele.dk!small.news.tele.dk!usenet.stanford.edu!usenet-its.stanford.edu!not-for-mail Newsgroups: news.software.nntp Organization: The Eyrie Lines: 30 NNTP-Posting-Host: windlord.stanford.edu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: usenet-its.stanford.edu 1294367126 5994 171.67.225.134 (7 Jan 2011 X-Complaints-To: news@usenet-its.stanford.edu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:J8Lw5YD5gkghBYC1VEG7hbQsakE=