Try this:
tr '\035' '\n' <stuff.marc | wc -l
--Th
-----Original Message-----
From: Jeffrey Barnett [mailto:jeffrey.barnett_at_yale.edu]
Sent: Wednesday, May 26, 2004 4:47 PM
To: CODE4LIB_at_LISTSERV.ND.EDU
Subject: Re: [CODE4LIB] Linfeed Trick
Hello, lurker speaking up. :-)
When I try this it doesn't seem to work. The escape sequences both wind
up being treated like the single character (number) 0 . (see below)
$ echo X |tr X Y
Y
$ echo X |tr X \012
0
$ echo X |tr X \035
0
$ echo XX |tr X \012
00
$ echo X | wc -l
1
$ echo XX |tr X \012 | wc -l
1
I'm thinking maybe there are some terminal or shell settings also needed?
Hickey,Thom wrote:
>Actually, I do like writing code, but ended up using 'tr' to do the
>substitution, even though I did come up with Python code that was actually
>faster.
>
>--Th
>
>
>-----Original Message-----
>From: Ed Summers [mailto:ehs_at_pobox.com]
>Sent: Wednesday, May 26, 2004 10:24 AM
>To: CODE4LIB_at_LISTSERV.ND.EDU
>Subject: Re: [CODE4LIB] Linfeed Trick
>
>On Wed, May 26, 2004 at 09:49:22AM -0400, Houghton,Andrew wrote:
>
>
>>cat *.mrc | tr \035 \012 | wc -l
>>
>>
>
>Isn't that shell code :)
>
>//Ed
>
>
Received on Wed May 26 2004 - 16:36:40 EDT