Print

Print


Maybe different shells?

Since at least Ed Summers said it would be interesting to see the Python
code I alluded to earlier, I've put together a (hopefully self contained)
package with some of our basic Python MARC-21 modules.  Those interested
should find a compressed tarball at:
http://staff.oclc.org/~hickey/obib/obib.20040527.tgz.  There is a readme.txt
file in there with some minimal explanation.  I'd be interested in comments
and suggestions.  Right now this code lacks documentation, but does show
that (with care) Python can be used on bibliographic databases of tens of
millions of records.

--Th


-----Original Message-----
From: Jeffrey Barnett [mailto:[log in to unmask]]
Sent: Thursday, May 27, 2004 8:53 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] Linfeed Trick

OK, now why do some folk need the extra quoting and others don't?
(redirect vs cat doesn't matter)

Hickey,Thom wrote:

>Try this:
>
>tr '\035' '\n' <stuff.marc | wc -l
>
>--Th
>
>
>-----Original Message-----
>From: Jeffrey Barnett [mailto:[log in to unmask]]
>Sent: Wednesday, May 26, 2004 4:47 PM
>To: [log in to unmask]
>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:[log in to unmask]]
>>Sent: Wednesday, May 26, 2004 10:24 AM
>>To: [log in to unmask]
>>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
>>
>>
>>
>>