I have sql's in a file separated by ";", need to put the sql in one single line till i find a ";" The input file is like this
I need the output as follows,
SELECT s.sid, s.serial#,p.spid as "OS PID", s.username,s.module, st.value/100 as "CPU sec" FROM v$sesstat st, v$statname sn, v$session s, v$process p WHERE sn.name = 'CPU used by this session' AND st.statistic#= sn.statistic# AND st.sid = s.sid AND s.paddr = p.addr AND s.last_call_et < 3600 AND s.logon_time > (SYSDATE - 240/1440) AND st.value/100 > 10 ORDER BY st.value;
SELECT s.sid, s.serial#, p.spid as "OS PID", s.username, s.module,se.time_waited, se.event FROM v$session_event se, v$session s, v$process p WHERE s.last_call_et < 3600 AND s.logon_time > (SYSDATE - 240/1440) AND se.sid = s.sid AND s.paddr = p.addr AND se.time_waited > 10 ORDER BY se.time_waited desc;
SELECT s.sid, s.serial#,p.spid as "OS PID", s.username,s.module, st.value/100 as "CPU sec" FROM v$sesstat st, v$statname sn, v$session s, v$process p WHERE sn.name = 'CPU used by this session' AND st.statistic#= sn.statistic# AND st.sid = s.sid AND s.paddr = p.addr AND s.last_call_et < 3600 AND s.logon_time > (SYSDATE - 240/1440) AND st.value/100 > 10 ORDER BY st.value;
till i see ";" i need to consider that as one single line and in next line i ll get next sql statement till one ;
thanks
gopal
Last edited by vbe; 02-05-2010 at 01:57 PM..
Reason: code tags please!
Hey thanks... Its a good one. when i used ur command it just executes a "return" when it finds a ";". But i need it in a single line till ";" When I redirected it shows multiple lines there.
Hey thanks... Its a good one. when i used ur command it just executes a "return" when it finds a ";". But i need it in a single line till ";" When I redirected it shows multiple lines there.
Kindly help me.
Ur o/p is contradicting to my o/p.
Thanks
gopal
how about
gives "a\tb" output
see 'man paste' for even cooler operations (like specifiyig delimiters).
Finally you can split up your line again at ';' using:
In your example (named your.code)
Last edited by Franklin52; 02-06-2010 at 10:11 AM..
Reason: Please use code tags!
Looking for help,
i have input file like below and want to modify to expected output, if can without create additional file, hope can direct modify it.
have 2 thing need do.
1st
is adding a word (testplan generation off) after ! ! IPG: Tue Aug 07 14:31:17 2018
2nd
is adding... (16 Replies)
I have code as below
# create temporary table `temp4277`(key(waybill_no))
select waybill_no,concat_ws('',card_type,card_series_no) cardinfo
from rfid_temp_ticket where waybill_no='4277'
group by... (4 Replies)
Hi!
I want to delete N (say 10) lines after the line which text is found in a file "A".Also to delete the line in which the text is found.
Only one occurrence of the search string in the file "A"
The text to be deleted is in another text file "B". All the search texts in the file "B" are in... (3 Replies)
Hi Everyone!
I would like ask if there's a better way I can delete multiple lines in a file1 by collecting all criteria from file2.
file1:
a
b
c
d
e
f
file2:
a
e
f
The expected value will be:
b (3 Replies)
example:
comment Now_TB.table column errac is for error messages
1 - first
2 - second
3 -third ;
in this example I need to be able to grab the comment as first word and ; as the last word and it might span a few lines. I need it to be put all in one line without line breaks so I can... (4 Replies)
I have a file like this
DoctorName
Address1
Address2
DOB
InsuredName
Address1
Address2
DOB
PatientName
Address1
Address2
DOB
ClaimNo1
DoctorName
Address1
Address2
DOB
InsuredName (2 Replies)
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
All I want is to look for the pattern in the file...If I found it at # places... I want print lines after those pattern(line) until I find a blank line.
Log EXAMPLE :
MT:Exception caught
The following Numbers were affected:
1234
2345
2346
Error
java.lang.InternalError:... (3 Replies)
Hi Guys,
I need a help. I am pretty new to the shell level programing. I was trying to split a long lines to a multiple lines with few conditions. I goggle for the code and found some snippets and tried to modified it but I got few strange problems too.
I have to split the lines if line is ... (3 Replies)