|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
File manupulation !
Hi Gurus !
1. I wrote a shell script to create a sql script which will create a table with partitions ... 2. I have done it using awk script to create the script ... the script has 507 lines ... but it can increase in future ... so I would like to dynamically modify the script ... Here is my problem ... at the end of the script : tablespace sv_test storage(initial 1m next 1m pctincrease 0 maxextents 200), In the above line I would like to replace the , with ) How can I do this in a shell script ? Any help is highly appreciated ! Thanks Vaithy |
|
#2
|
|||
|
|||
|
I don't fully understand what you're doing but sub()
takes a regular expression for the first argument, and a replacement string like this Code:
sub(/$\),/,"))",$0) |
|
#3
|
|||
|
|||
|
Hi Jim,
Thanks for your reply ... Here is what I meant ... I have a file which looks like : PARTITION sv_03000_p values ('03000') tablespace sv storage(initial 1m next 1m pctincrease 0 maxextents 200), PARTITION sv_03001_p values ('03001') tablespace sv storage(initial 1m next 1m pctincrease 0 maxextents 200), PARTITION sv_04005_p values ('04005') tablespace sv storage(initial 1m next 1m pctincrease 0 maxextents 200), PARTITION sv_04072_p values ('04072') tablespace sv storage(initial 1m next 1m pctincrease 0 maxextents 200), PARTITION sv_04221_p values ('04221')) tablespace sv storage(initial 1m next 1m pctincrease 0 maxextents 200), In the above text ... in each line there is a , at the end ... I want to replace the , with ) only at the last line of the script. How can I do that in a shell script ?! Thanks Vaithy |
|
#4
|
|||
|
|||
|
sed -e '$s/,[ ]*$/)/' yourFile
|
|
#5
|
|||
|
|||
|
Quote:
That worked !!! Thanks and appreciate your help. Vaithy |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > File manupulation ! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|