Help,
I am running Solaris 2.6, and have only ever written scripts for the Korn
Shell......and have the following query......
I have a very long text file ( each line represents a CAD model name ).
Somewhere within the model name (i.e. line of the text file ) , is the
drawing reference number......this number will always match a particular
pattern of letters, hyphens and numbers - which will not be matched
elsewhere within the remainder of the line.
I need a mechanism to search each line in turn, match the pattern of
letters, hyphens and numbers and extract purely that portion of the line and
write it to a separate file. My problem , is that the pattern could appear
anywhere within each line and the number of fields can differ ( if it was
always in the same place or had a constant number of fields, I would use
'cut' )
For example, an extract from the input file could be :-
LD100 WEIGHT DAMPER W7A 22 Z 535210043-A USE30SE99MVS
99/10/26
LD100 GROMMET GUIDE ROD W5D 12 Z 545180058-B USE30SE99MAK
99/10/26
LD100 GROMMET GUIDE ROD W5D 22 Z 545180058-B USE30SE99MAK
99/10/26
LD100 BRACKET-CABLE,SELECT W7A 12 Z 535210034-C USE06SE99LJL
99/10/26
LD100 BRACKET-CABLE,SELECT W7A 22 Z 535210034-C USE06SE99LJL
99/10/26
And I need to extract the data matching the following pattern: nine
numbers,a hypen and a letter and put it in an output file - thus the output
I would like to see is :-
535210043-A
545180058-B
545180058-B
535210034-C
535210034-C
Many thanks in advance for your help
Mark Hounslow
LDV Limited