Sponsored Content
Top Forums Shell Programming and Scripting how to redirect the output of a grep command to a file inside a shell script Post 302206381 by kripssmart on Tuesday 17th of June 2008 02:36:36 PM
Old 06-17-2008
hi kamalesh,

i tried that grep command.. but can you say me what the option -il is about... actually.. what i am tying to do is that, i am formatting some file and the contents of the file i am passing it as a parameter to an sql query..

so, i will be connecting to sqlplus and i am executing the query.. the output of which i am getting in some file.. and i want to remove the last line in the sql query like "24 rows selected" etc from this file .so for that i am using grep -v option. and here i am trying to redrect the output to a file where i am stuck..

also i want to use the spool command ..to spool this output of the sql query and to create a .lst file.. where i am again stuck..Smilie

thanks for the great help..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirect grep output into file !!!!!

Hi, I am writing the following code in command prompt it is working fine. grep ',222,' SAPPCO_20080306.CSV_old > SAPPCO_20080306.CSV_new But the command is not working in the Shell Script... ########################################## #!/bin/sh #... (2 Replies)
Discussion started by: hanu_oracle
2 Replies

2. UNIX for Dummies Questions & Answers

how to get the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)
Discussion started by: kripssmart
1 Replies

3. Shell Programming and Scripting

How redirect script output from inside of script?

Is it possible to redirect a script output by command inside of that script? I mean, if I have a script 'dosome.sh' I could run it by >dosome.sh > dosome.log I would dream to get some command inside of scrip to do the same; so, running the dosome.sh would have all output redirected to a log... (4 Replies)
Discussion started by: alex_5161
4 Replies

4. Programming

Redirect input and output to a shell script?

Dear All: I am trying to do something that (I thought) was relatively straightforward, but my code snippet does not seem to work. Any suggestions? Thank you Sincerely yours Misha Koshelev #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include... (0 Replies)
Discussion started by: misha680
0 Replies

5. UNIX and Linux Applications

How to redirect grep command output to same file

Hi Everyone, Can anyone please tell me, how can I redirect the grep command output to same file. I am trying with below command but my original file contains no data after executing the command. $grep pattern file1 > file1 Kind Regards, Eswar (5 Replies)
Discussion started by: picheswa
5 Replies

6. Shell Programming and Scripting

Redirect the output in shell script for tftp

I've been using tftp in one of my file #!/bin/bash filename1="config1h.txt" filename2="config15.txt" hostname="test.com" tftp $hostname <</dev/null get $filename1 get $filename2 quit EOF My output looks like this # ./test3.sh tftp> Received 1262 bytes in 0.0 seconds tftp> Received... (2 Replies)
Discussion started by: LavanyaP
2 Replies

7. Shell Programming and Scripting

Shell Script to grep output from top command.

Hello, I want a script which would grep details from top command for specific processes. I m not sure of the PID of these processes but i know the names. $ top -c top - 16:41:55 up 160 days, 5:53, 2 users, load average: 9.36, 9.18, 8.98 Tasks: 288 total, 9 running, 279 sleeping, 0... (8 Replies)
Discussion started by: Siddheshk
8 Replies

8. Programming

How to redirect the output of a shell script to a file?

hi, i have a html form which call a perl program, this perl program calls a shell script. <html> <head> <title>demo</title> </head> <body> <form name="frm1" action="/cgi-bin/perl_script.pl" method="post"> <input type="text" name="fname"> ... (1 Reply)
Discussion started by: Little
1 Replies

9. Shell Programming and Scripting

How to redirect the output of a command inside ftp block?

hi, i am using ftp to get files from remote server. inside the ftp i want to us ls -ltr command and send the output of it to a file. ftp -n remote_server <<_FTP quote USER username quote PASS password prompt noprompt pwd ls -ltr get s1.txt bye _FTP i... (4 Replies)
Discussion started by: Little
4 Replies

10. Shell Programming and Scripting

Redirect script output to file after grep

i have simple program that generate log file 1 line every sec, i need to do grep for specific record then redirect to another file. #!/bin/bash for i in `seq 1 20`; do echo $i sleep 1 done ./test.sh |egrep "5|10|15" 5 10 15 r ./test.sh... (2 Replies)
Discussion started by: before4
2 Replies
CUBRID_EXECUTE(3)							 1							 CUBRID_EXECUTE(3)

cubrid_execute - Execute a prepared SQL statement

SYNOPSIS
resource cubrid_execute (resource $conn_identifier, string $sql, [int $option]) DESCRIPTION
bool cubrid_execute (resource $request_identifier, [int $option]) The cubrid_execute(3) function is used to execute the given SQL statement. It executes the query by using $conn_identifier and SQL, and then returns the request identifier created. It is used for simple execution of query, where the parameter binding is not needed. In addi- tion, the cubrid_execute(3) function is used to execute the prepared statement by means of cubrid_prepare(3) and cubrid_bind(3). At this time, you need to specify arguments of $request_identifier and $option. The $option is used to determine whether to get OID after query execution and whether to execute the query in synchronous or asynchronous mode. CUBRID_INCLUDE_OID and CUBRID_ASYNC (or CUBRID_EXEC_QUERY_ALL if you want to execute multiple SQL statements) can be specified by using a bitwise OR operator. If not specified, neither of them isselected. If the flag CUBRID_EXEC_QUERY_ALL is set, a synchronous mode (sync_mode) is used to retrieve query results, and in such cases the following rules are applied: oThe return value is the result of the first query. o If an error occurs in any query, the execution is processed as a failure. o In a query composed of q1 q2 q3, if an error occurs in q2 after q1 succeeds the execution, the result of q1 remains valid. That is, the previous successful query executions are not rolled back when an error occurs. o If a query is executed successfully, the result of the second query can be obtained using cubrid_next_result(3). If the first argument is $request_identifier to execute the cubrid_prepare(3) function, you can specify an option, CUBRID_ASYNC only. PARAMETERS
o $conn_identifier -Connection identifier. o $sql -SQL to be executed. o $option -Query execution option CUBRID_INCLUDE_OID, CUBRID_ASYNC, CUBRID_EXEC_QUERY_ALL. o $request_identifier -cubrid_prepare(3) identifier. RETURN VALUES
Request identifier, when process is successful and first param is conn_identifier; TRUE, when process is successful and first argument is request_identifier. FALSE, when process is unsuccessful. CHANGELOG
+--------+----------------------------------------+ |Version | | | | | | | Description | | | | +--------+----------------------------------------+ | 8.4.0 | | | | | | | Add new option CUBRID_EXEC_QUERY_ALL. | | | | +--------+----------------------------------------+ EXAMPLES
Example #1 cubrid_execute(3) example <?php $conn = cubrid_connect("localhost", 33000, "demodb"); $result = cubrid_execute($conn, "SELECT code FROM event WHERE name='100m Butterfly' and gender='M'", CUBRID_ASYNC); $row = cubrid_fetch_array($result, CUBRID_ASSOC); $event_code = $row["code"]; cubrid_close_request($result); $history_req = cubrid_prepare($conn, "SELECT * FROM history WHERE event_code=?"); cubrid_bind($history_req, 1, $event_code, "number"); cubrid_execute($history_req); printf("%-20s %-9s %-10s %-5s ", "athlete", "host_year", "score", "unit"); while ($row = cubrid_fetch_array($history_req, CUBRID_ASSOC)) { printf("%-20s %-9s %-10s %-5s ", $row["athlete"], $row["host_year"], $row["score"], $row["unit"]); } cubrid_close_request($history_req); cubrid_disconnect($conn); ?> The above example will output: athlete host_year score unit Phelps Michael 2004 51.25 time SEE ALSO
cubrid_prepare(3), cubrid_bind(3), cubrid_next_result(3), cubrid_close_request(3), cubrid_commit(3), cubrid_rollback(3). PHP Documentation Group CUBRID_EXECUTE(3)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy