I need help parsing this bit of text into the output shown below:
Text:
dump database abc123 to 'compress::0::/dbdumps/abc123_20100930_1251:00.dump1'
stripe on 'compress::0::/dbdumps/abc123_20100930_1251:00.dump2'
go
dump database abc_def to 'compress::0::/dbdumps/abc_def_20100930_1251:00.dump1'
go
Here abc123 and abc_def are database names
Dump files for database abc123 will be created in 2 stripes and will be saved as:
dbdumps/abc123_20100930_1251:00.dump1
dbdumps/abc123_20100930_1251:00.dump2
The dump file for database abc_def will be saved as:
abc123_20100930_1251:00.dump2'
What I am trying to do is to create soft links as below
abc123.dump1->abc123_20100930_1251:00.dump1
abc123.dump2->abc123_20100930_1251:00.dump2
abc_def.dump1->abc_def_20100930_1251:00.dump1
In the output the first word is the database name (which may be alphanumeric and may also have underscores and hyphens). The dump[n] prefix is what exists on the dump file name and should be appended to the database name to create the soft link.
Any suggestions on how this can be accomplished? I am using ksh.