fabiano petrone
asked on
perl script
Hello, Experts
I'm asking (if possible) a little code that makes some transformation on a given text.
I've some bibliographical records in this format:
000000369 FMT L BK
000000369 LDR L -----nls--22--------450-
000000369 100 L $$a20130829a--------km-y0i tay50----- -ba
000000369 2001 L $$a<<L' >>Arte della grammatica$$fLorenzo Valla
000000369 210 L $$aMilano$$cArnoldo Mondadori Editore$$d1990
000000369 BAS L $$a1
000000369 BAS L $$a68
000000369 BAS L $$aRECUPERO BONFIETTI
000000369 COP L $$sMANMO$$fCB806$$cM/Valla /E1$$iGFC- 7794$$j28/ 11/1992$$p 18,08$$mBO OK$$z36$$t BATCH
000000371 FMT L BK
000000371 LDR L -----nls--22--------450-
000000371 100 L $$a20130829a--------km-y0i tay50----- -ba
000000371 2001 L $$aManuscript liisting for the authors of classical and late antiquity$$fRobert E. Sinkewicz
000000371 210 L $$aToronto$$cPontifical Institute of Mediaeval Studies$$d1990
000000371 BAS L $$a1
000000371 BAS L $$a68
000000371 BAS L $$aRECUPERO BONFIETTI
000000371 COP L $$sMANMO$$fCB806$$cA Phil/Sin/1(III)$$iGFC-1207 3$$j28/10/ 2003$$p19$ $mBOOK$$z3 6$$tBATCH
<etc..>
I'd like to isolate -with a script- two parts of it and separate them with a "|"
the 2 parts that I want to isolate are the following:
1) begins always with "2001 L $$a" and ends always with a "$"
2) begins always with "BAS L $$a" and end with a newline
continuing the previous example, from the 2 previous records I'd like to obtain something similar to:
<<L' >>Arte della grammatica|1|68|RECUPERO BONFIETTI
Manuscript liisting for the authors of classical and late antiquity|1|68|RECUPERO BONFIETTI
<etc..>
Thanks in advance for your precious help,
fabianope
I'm asking (if possible) a little code that makes some transformation on a given text.
I've some bibliographical records in this format:
000000369 FMT L BK
000000369 LDR L -----nls--22--------450-
000000369 100 L $$a20130829a--------km-y0i
000000369 2001 L $$a<<L' >>Arte della grammatica$$fLorenzo Valla
000000369 210 L $$aMilano$$cArnoldo Mondadori Editore$$d1990
000000369 BAS L $$a1
000000369 BAS L $$a68
000000369 BAS L $$aRECUPERO BONFIETTI
000000369 COP L $$sMANMO$$fCB806$$cM/Valla
000000371 FMT L BK
000000371 LDR L -----nls--22--------450-
000000371 100 L $$a20130829a--------km-y0i
000000371 2001 L $$aManuscript liisting for the authors of classical and late antiquity$$fRobert E. Sinkewicz
000000371 210 L $$aToronto$$cPontifical Institute of Mediaeval Studies$$d1990
000000371 BAS L $$a1
000000371 BAS L $$a68
000000371 BAS L $$aRECUPERO BONFIETTI
000000371 COP L $$sMANMO$$fCB806$$cA Phil/Sin/1(III)$$iGFC-1207
<etc..>
I'd like to isolate -with a script- two parts of it and separate them with a "|"
the 2 parts that I want to isolate are the following:
1) begins always with "2001 L $$a" and ends always with a "$"
2) begins always with "BAS L $$a" and end with a newline
continuing the previous example, from the 2 previous records I'd like to obtain something similar to:
<<L' >>Arte della grammatica|1|68|RECUPERO BONFIETTI
Manuscript liisting for the authors of classical and late antiquity|1|68|RECUPERO BONFIETTI
<etc..>
Thanks in advance for your precious help,
fabianope
ASKER
Hello, ozo
thanks a lot for the reply.
is it possible to put this code inside a little script that I call from a console like 'script.pl <input.txt>output.txt'?
thanks again,
fabianope
thanks a lot for the reply.
is it possible to put this code inside a little script that I call from a console like 'script.pl <input.txt>output.txt'?
thanks again,
fabianope
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Super-Thanks!! :=))
000000369 FMT L BK
000000369 LDR L -----nls--22--------450-
000000369 100 L $$a20130829a--------km-y0i
000000369 2001 L $$a<<L' >>Arte della grammatica$$fLorenzo Valla
000000369 210 L $$aMilano$$cArnoldo Mondadori Editore$$d1990
000000369 BAS L $$a1
000000369 BAS L $$a68
000000369 BAS L $$aRECUPERO BONFIETTI
000000369 COP L $$sMANMO$$fCB806$$cM/Valla
000000371 FMT L BK
000000371 LDR L -----nls--22--------450-
000000371 100 L $$a20130829a--------km-y0i
000000371 2001 L $$aManuscript liisting for the authors of classical and late antiquity$$fRobert E. Sinkewicz
000000371 210 L $$aToronto$$cPontifical Institute of Mediaeval Studies$$d1990
000000371 BAS L $$a1
000000371 BAS L $$a68
000000371 BAS L $$aRECUPERO BONFIETTI
000000371 COP L $$sMANMO$$fCB806$$cA Phil/Sin/1(III)$$iGFC-1207
<etc..>