print a function result in new file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting print a function result in new file
# 1  
Old 12-31-2007
print a function result in new file

Hi,

i have a function which return a variable .

serach ( paramatere) when i excute this function i get the result in the shell,

i want to print this result in a file by calling just the function.

how can i do it..

the code example is like that:

search ( )
{
..
}

the call must be done in the new file :

awk -F "," '{ {first=$1; sec=$2; tro=$3;quat=$4 }
if (tro == "")
{

$3 = search ( )

{print $1","$2","","$4} }
else
{print $1","$2","$3 $4}}' $file1 > $file2


i print the four variable in file1 delimitated by comma and i want to affect the result of function search to the variable $3?


when i write like that i don't have a result.
how can i do
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To get or print specific value in result

i am executing below code to achive my result, but for second row the value is not coming it should come URL like other two . url start with http:// and end with .xhtml cat FILE | grep 'Test failed' | awk -F',' '{print $3,$8,$12}' INPUT 1517679173303,84,SKILLED LANGUAGE - ENTER... (11 Replies)
Discussion started by: mirwasim
11 Replies

2. Shell Programming and Scripting

Compare 2 columns from the same file and print a value depending on the result

Hello Unix gurus, I have a file with this format (example values): label1 1 0 label2 1 0 label3 0.4 0.6 label4 0.5 0.5 label5 0.1 0.9 label6 0.9 0.1 in which: column 1 is a row label column 2 and 3 are values I would like to do a simple operation on this table and get the... (8 Replies)
Discussion started by: ksennin
8 Replies

3. Shell Programming and Scripting

Print smallest integer from file using awk custom function?

`awk` function looks like this in a file name `fun.awk`: { print small() } function small() { a=$0 smal=0 for(i=1;i<=3;i++) { if( a<a) smal=a else (4 Replies)
Discussion started by: lazerz
4 Replies

4. UNIX for Dummies Questions & Answers

Print result of mv -n

I am trying to move files which donot have same filename using find /Users/ParijatMac/desktop/unix/new_dir -type f -mmin +"$HRS" -exec mv -n "{}" /Users/ParijatMac/desktop/unix/old_dir \; -print but i am getting all filenames including the ones with duplicate names.Please help me to sort... (5 Replies)
Discussion started by: parijat guh
5 Replies

5. Shell Programming and Scripting

Print if found non-desired result

I have a result like this root@server # grep -rl maldet /etc/cron* /etc/cron.d/maldet_daily /etc/cron.d/malcron /etc/cron.d/malcrondaily /etc/cron.d/malcronweekly What I need is, I need an if/else condition such that, if there is any output other than /etc/cron.d/maldet_daily in the... (8 Replies)
Discussion started by: anil510
8 Replies

6. Shell Programming and Scripting

Use the print result of a script as an argument

Hi all, Say I have a script named script.sh. What it does is to print a line like "abc" #! /usr/bin/ksh print "abc" I would like to pass this value to an external variable, var1="script.sh" However when I echo $var1 I got "script.sh" itself instead of the result? Thanks (3 Replies)
Discussion started by: isaacniu
3 Replies

7. Shell Programming and Scripting

A function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can help me... (3 Replies)
Discussion started by: fw0037
3 Replies

8. Shell Programming and Scripting

a function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can... (1 Reply)
Discussion started by: fw0037
1 Replies

9. Homework & Coursework Questions

A function in shell script,how can i get the right result

there is a directory /data/users/osa/psidp/dmp/files/cimdir ,it have some subdirectories ,and also the subdirectoriy have it's subdirectoriis. I want to get all the leaf nodes of the directory path . but the result of the script is wrong ,how can i get the right result somebody who can help... (1 Reply)
Discussion started by: fw0037
1 Replies

10. Shell Programming and Scripting

print out result from data file

i got a data file which contains all the pid,ppid,user,command,pcpu,start_time,status. I wanted to display out the pcpu which is greater than 0. i uses awk'{if($5 > 0){print}}' filename.txt but is printing out result which not i wanted. Is there any way which i can print out those pcpu which is... (8 Replies)
Discussion started by: thms_sum
8 Replies
Login or Register to Ask a Question
DB2_NEXT_RESULT(3)							 1							DB2_NEXT_RESULT(3)

db2_next_result - Requests the next result set from a stored procedure

SYNOPSIS
resource db2_next_result (resource $stmt) DESCRIPTION
A stored procedure can return zero or more result sets. While you handle the first result set in exactly the same way you would handle the results returned by a simple SELECT statement, to fetch the second and subsequent result sets from a stored procedure you must call the db2_next_result(3) function and return the result to a uniquely named PHP variable. PARAMETERS
o $stmt - A prepared statement returned from db2_exec(3) or db2_execute(3). RETURN VALUES
Returns a new statement resource containing the next result set if the stored procedure returned another result set. Returns FALSE if the stored procedure did not return another result set. EXAMPLES
Example #1 Calling a stored procedure that returns multiple result sets In the following example, we call a stored procedure that returns three result sets. The first result set is fetched directly from the same statement resource on which we invoked the CALL statement, while the second and third result sets are fetched from state- ment resources returned from our calls to the db2_next_result(3) function. <?php $conn = db2_connect($database, $user, $password); if ($conn) { $stmt = db2_exec($conn, 'CALL multiResults()'); print "Fetching first result set "; while ($row = db2_fetch_array($stmt)) { var_dump($row); } print " Fetching second result set "; $res = db2_next_result($stmt); if ($res) { while ($row = db2_fetch_array($res)) { var_dump($row); } } print " Fetching third result set "; $res2 = db2_next_result($stmt); if ($res2) { while ($row = db2_fetch_array($res2)) { var_dump($row); } } db2_close($conn); } ?> The above example will output: Fetching first result set array(2) { [0]=> string(16) "Bubbles " [1]=> int(3) } array(2) { [0]=> string(16) "Gizmo " [1]=> int(4) } Fetching second result set array(4) { [0]=> string(16) "Sweater " [1]=> int(6) [2]=> string(5) "llama" [3]=> string(6) "150.00" } array(4) { [0]=> string(16) "Smarty " [1]=> int(2) [2]=> string(5) "horse" [3]=> string(6) "350.00" } Fetching third result set array(1) { [0]=> string(16) "Bubbles " } array(1) { [0]=> string(16) "Gizmo " } PHP Documentation Group DB2_NEXT_RESULT(3)