Break a line

Hi,
I have a file with thousands of lines like this:

update table set col1='XXX'; commit;

I want to break the line as follow:
update table set col1='XXX';
commit;
How to do?
Thanks.

hi

what have you tried (please share attempts)

any particular reason you want to do this ?

thks

Hi,
Thank you.
I ran it in sqlplus but I had:
ERROR at line 1:
ORA-00911: invalid character
Regards.

show your attempts please ? (did you even attempt?) many examples online

something like
sed -i 's/commit;/\ncommit;/g' YOURFILEHERE

Thank you.
Let me try.
regards.

I tried:

sed -i 's/commit;/\ncommit;/g' myfile.txt
sed: Not a recognized flag: i
Usage:  sed [-n] [-u] Script [File ...]
        sed [-n] [-u] [-e Script] ... [-f Script_file] ... [File ...]

Thank you.
ps:
uname -a
AIX myserver 1 7 00F9857E4C00

ah yes, the challenges of AIX :rofl: ,

try

perl -pi -e 's/commit;/\ncommit;/g' yourfile

the sed command below should probably work as well. - as always , test on throwaway data !!!!

sed -e 's/commit;/\ncommit;/g' myfile > mynewfile

1 Like

Thanks.
I ran

perl -pi -e 's/commit;/\ncommit;/g' myfile
cat myfile
update table set col1='XXX'; 
commit;

It worked fine.
Thanks again.

2 Likes