Ramnarayan
Programmer
Hi
I have a database file which has the below output:
_t2 AP001653 07382480 AP020003
_vl 1
_is 1
_t2 AP001653 07382480 AP020004
_vl 1
_is 2
_t2 AP001653 07382480 AP020005
_vl 2.01
_is 1/2
_t2 AP001653 07382480 AP020006
_vl 2.02
_is 3/4
_t2 AP001653 07382480 AP020007
_vl 3
_is 1
_t2 AP001653 07382480 AP020008
_vl 3
_is 2
_t2 AP001653 07382480 AP020009
_vl 4
_is 1
_t2 AP001653 07382480 AP020010
_vl 4
_is 2
_t2 AP001653 07382480 AP020011
_vl 5
_is 1
_t2 AP001653 07382480 AP020012
_vl 5
_is 2
_t2 AP001653 07382480 AP020013
_vl 6
_is 1
_t2 AP001653 07382480 AP020014
_vl 6
_is 2
Now, I need to write a script that should be able to give me the below output:
Dataset: AP001653 ISSN# 07382480 (This is got from the 2nd column of _t2 line. Has to be same for all the _t2 lines)
Volume# 1-6 (Range of the first volume and the last volume below)
Issue# 1-2 (Range of the first issue and the last issue below)
AP020003 Vol. 1 Iss. 1
AP020004 Vol. 1 Iss. 2
AP020005 Vol. 2.01 Iss. 1/2
AP020006 Vol. 2.02 Iss. 3/4
AP020007 Vol. 3 Iss. 1
AP020008 Vol. 3 Iss. 2
AP020009 Vol. 4 Iss. 1
AP020010 Vol. 4 Iss. 2
AP020011 Vol. 5 Iss. 1
AP020012 Vol. 5 Iss. 2
AP020013 Vol. 6 Iss. 1
AP020014 Vol. 6 Iss. 2
Kindly help me with a script so that I can know better in pattern matching as i am very poor in that!
I have a database file which has the below output:
_t2 AP001653 07382480 AP020003
_vl 1
_is 1
_t2 AP001653 07382480 AP020004
_vl 1
_is 2
_t2 AP001653 07382480 AP020005
_vl 2.01
_is 1/2
_t2 AP001653 07382480 AP020006
_vl 2.02
_is 3/4
_t2 AP001653 07382480 AP020007
_vl 3
_is 1
_t2 AP001653 07382480 AP020008
_vl 3
_is 2
_t2 AP001653 07382480 AP020009
_vl 4
_is 1
_t2 AP001653 07382480 AP020010
_vl 4
_is 2
_t2 AP001653 07382480 AP020011
_vl 5
_is 1
_t2 AP001653 07382480 AP020012
_vl 5
_is 2
_t2 AP001653 07382480 AP020013
_vl 6
_is 1
_t2 AP001653 07382480 AP020014
_vl 6
_is 2
Now, I need to write a script that should be able to give me the below output:
Dataset: AP001653 ISSN# 07382480 (This is got from the 2nd column of _t2 line. Has to be same for all the _t2 lines)
Volume# 1-6 (Range of the first volume and the last volume below)
Issue# 1-2 (Range of the first issue and the last issue below)
AP020003 Vol. 1 Iss. 1
AP020004 Vol. 1 Iss. 2
AP020005 Vol. 2.01 Iss. 1/2
AP020006 Vol. 2.02 Iss. 3/4
AP020007 Vol. 3 Iss. 1
AP020008 Vol. 3 Iss. 2
AP020009 Vol. 4 Iss. 1
AP020010 Vol. 4 Iss. 2
AP020011 Vol. 5 Iss. 1
AP020012 Vol. 5 Iss. 2
AP020013 Vol. 6 Iss. 1
AP020014 Vol. 6 Iss. 2
Kindly help me with a script so that I can know better in pattern matching as i am very poor in that!