![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| (sed) parsing insert statement column that crosses multiple lines | jjordan | Shell Programming and Scripting | 3 | 10-09-2007 12:23 AM |
| unix command to insert double quotes | berlin_germany | Shell Programming and Scripting | 2 | 01-17-2007 01:07 PM |
| Script does not execute Insert Statement | Amruta Pitkar | Shell Programming and Scripting | 4 | 08-24-2006 11:14 PM |
| sql insert command | abey | Shell Programming and Scripting | 2 | 05-19-2006 11:56 AM |
| Insert TAB in echo statement | sunils27 | Shell Programming and Scripting | 5 | 08-26-2005 03:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi,
I sometimes bulk upload data in oracle. The problem is that I sometimes get an INSERT statemnt like this: INSERT INTO ALL_USER_HOTSPOT_DETAILS (USR_LOGIN,USR_LASTNAME,USR_FIRSTNAME,USR_EMAIL, PROPERTYNR) VALUES ('SABRDAG','D'AGOS','SABRINA','sabrina_d'agos@sheraton.com',70) I would like to run an awk or sed command that would take care of the single quotes in the INSERT statement. So the above string should be INSERT INTO ALL_USER_HOTSPOT_DETAILS (USR_LOGIN,USR_LASTNAME,USR_FIRSTNAME,USR_EMAIL,PROPERTYNR) VALUES ('SABRDAG','D''AGOS','SABRINA','sabrina_d''agos@sheraton.com',70); I have tried awk but couldnt make it work. Any help would be appreciated. Thanx |
|
|||||
|
I'm not sure that I understand exactly was is going on here. But I think that you want any single quote surrounded by letters to become two single quotes. If that is correct (and it does seem crazy), try this...
sed "s/\([a-zA-Z]\)\'\([a-zA-Z]\)/\1\'\'\2/g" |
|
|||||
|
Quote:
Replacing the single tic with two single tics isn't crazy at all. After the insert takes place, the two single tics are converted into a single tic. It's the same for MS SQL Server as well. The Perl code above can be fixed by replacing double quote with two single quotes back to back, but the sed expression is much cleaner. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|