Hello,
I have a file with variable length records. I need to extract the 7 bytes pattern "P??????" , then contatenated with ".txt" and save it to the file.
How can I do it with awk or ksh. Any help is greatly appreciated.
Here are some "rules".
Each field across could contain spaces
Pattern has a random position in column.
"/" is a delimiter between fields.
Thanks in advance!
Here is a input file:
/Folder1/Next Directory/Productivity-LA/New Money/HFC & MBNA/Weekly/P6A3103_02-15-2004.roi
/Folder1/Next Directory/Affiliate/HCS/New Money/Weekly/P6A3301_02-15-2004.roi
/Folder1/Next Directory/Affiliate/HRS/New Money/Weekly/P6A3302_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Get Smart/New Money/Weekly/P6A3303_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA All/New Money/Weekly/P6A3502_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA Prior/New Money/Weekly/P6A3503_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA New/New Money/Weekly/P6A3504_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA No/New Money/Weekly/P6A3505_02-15-2004.roi
/Folder1/Next Directory/Affiliate/BET/New Money/Weekly/P6A3601_02-15-2004.roi
Here is an output I would like to get:
P6A3103.txt
P6A3301.txt
P6A3302.txt
P6A3303.txt
P6A3502.txt
P6A3503.txt
P6A3504.txt
P6A3505.txt
P6A3601.txt
Thanks!
I have a file with variable length records. I need to extract the 7 bytes pattern "P??????" , then contatenated with ".txt" and save it to the file.
How can I do it with awk or ksh. Any help is greatly appreciated.
Here are some "rules".
Each field across could contain spaces
Pattern has a random position in column.
"/" is a delimiter between fields.
Thanks in advance!
Here is a input file:
/Folder1/Next Directory/Productivity-LA/New Money/HFC & MBNA/Weekly/P6A3103_02-15-2004.roi
/Folder1/Next Directory/Affiliate/HCS/New Money/Weekly/P6A3301_02-15-2004.roi
/Folder1/Next Directory/Affiliate/HRS/New Money/Weekly/P6A3302_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Get Smart/New Money/Weekly/P6A3303_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA All/New Money/Weekly/P6A3502_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA Prior/New Money/Weekly/P6A3503_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA New/New Money/Weekly/P6A3504_02-15-2004.roi
/Folder1/Next Directory/Affiliate/Folder1 Direct/MBNA No/New Money/Weekly/P6A3505_02-15-2004.roi
/Folder1/Next Directory/Affiliate/BET/New Money/Weekly/P6A3601_02-15-2004.roi
Here is an output I would like to get:
P6A3103.txt
P6A3301.txt
P6A3302.txt
P6A3303.txt
P6A3502.txt
P6A3503.txt
P6A3504.txt
P6A3505.txt
P6A3601.txt
Thanks!