[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: =| and newlines
- To: "Dallman Ross" <http://www.nomotek.com/~dman+noacks>
- Subject: RE: =| and newlines
- From: http://dummy.us.eu.org/robert (robert)
- Date: Tue, 4 Sep 2001 09:23:37 -0400
- In-Reply-To: <http://www.nomotek.com/~NABBKHCMDIMOMKICOABJOEFNJDAA.dman>
- Keywords: http://www.nomotek.com/~dman robert, Re: =| and newlines
> From: "Dallman Ross" <http://www.nomotek.com/~dman>
> Date: Fri, 31 Aug 2001 20:00:37 +0200
>
> > Yes, I later discovered that I was incorrect. The problem turned
> > out to have
> > nothing to do with newlines, but rather spaces.
> >
> > The problem was this:
> >
> > NUMWORDS=`wc -w`
>
> > . . . .
>
> > I fixed this by adding:
> >
> > :0w
> > *NUMWORDS??^^[ ]*\/[0-9]+
> > { NUMWORDS=$MATCH }
> >
> > before the sed gets executed.
>
> Prolly not relevant here, but you might find it useful in
> general to know that one can get rid of the leading whitespace
> with wc by piping through "xargs".
>
> 2:00pm ulysium:~> wc -l < $MAIL
> 0
> 2:00pm ulysium:~> wc -l < $MAIL | xargs
> 0
>
> (But I'm not a fan of extra pipes.)
>
> Also, if you're trying to find lines instead of words,
> you can use grep -c instead of wc and avoid the problem.
>
> 2:02pm ulysium:~> grep -c . $MAIL
> 0
Ah, very clever! Thanks!
> --
> Dallman Ross <http://www.nomotek.com/~dman>
> Residence Telephone: +49 (6122) 98 04 46
> Cellular Telephone: +49 (177) 515 34 69
> U.S. Voicemail/Fax: +1 (415) 276-2873
> U.S. Cellular Telephone: +1 (415) 317-ROSS (317-7677)
> Fight Spam! Join CAUCE! == http://www.cauce.org/ or
> http://www.euro.cauce.org/
> N.B.: For no auto-reply, use <http://www.nomotek.com/~dman+noacks>