Apply different replacement on a single regular expression..
Posted: Mon Aug 25, 2008 7:47 am
I have this set of text..
p/s: Each table and its respective columns appear on one single line
The 1st part is the table name and the rest are their respective columns.
My objective is to made a replacement in such a way..
select source, max(column_1), max(column_2),..... max(column_n)
from table_name group by source;
I manage to select each line using this RE:
But my problem is.. How do I tag the expression so that I can apply max(column_name) to each column that follows the table name?
Thank you very much.
Code: Select all
ADSCARD ADSLAM_IDENT_CODE CARD_TYPE END_PORT_NUM END_VCI_NUM START_PORT_NUM START_VCI_NUM
ADSLAM ADSLAM_IDENT_CODE BUILD_IDENT_CODE CARD_TYPE CONTRACTOR_NUM DSLAM_ADDR
ADSLBAR BUILD_IDENT_CODE CODESYS_ID
ADSLMPR ADSLAM_IDENT_CODE ADSL_PAIR_NUM CABINET_IDENT_CODE CARD_TYPE DPSDF_IDENT_CODE
BASE_TRAN BTS_ADDR_LINE1 BTS_IDENT_CODE BTS_NAME COST_CENTER_CODE EXCHANGE_IDENT_CODEThe 1st part is the table name and the rest are their respective columns.
My objective is to made a replacement in such a way..
select source, max(column_1), max(column_2),..... max(column_n)
from table_name group by source;
I manage to select each line using this RE:
Code: Select all
(^\<[[:graph:]]{1,20}\>)([[:space:]]{1,20}\<[[:graph:]]{1,50}\>){1,10}Thank you very much.