Sponsored Content
Top Forums Shell Programming and Scripting Format output into columns, variables with multiple entries Post 302805695 by RudiC on Friday 10th of May 2013 04:45:27 PM
Old 05-10-2013
Add a "\n" to the end of the printf statement, and use double quotes around each variable.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sql output from multiple rows and columns as variables in a script

This is for an Oracle journal import. I was using a pl/sql package and oracle API's. Oracle added invoker rights to their API's and now my package won't run. I didn't want to use their API's anyway. The only reason i was using pl/sql and the API's (just a package) was to utilize a cursor. How... (2 Replies)
Discussion started by: lmu
2 Replies

2. Shell Programming and Scripting

Format output from command from variables

Hi , I have below command to that outputs from variables.. command: echo $INSTANCE $DATAB $status $TSLastBackup| awk '{printf("%-8s %-8s \t \n",$1,$2,$3,$4)}' | tee $LOGF the ouput is now: INSTANCE DATABSE BACKUP_STATUS BACKUPTIMESTAMP ------- -------- -------- ... (1 Reply)
Discussion started by: db2_usd
1 Replies

3. Shell Programming and Scripting

awk output to multiple variables

Hi I need to assign the ouput of a awk statement to two variables; below is a example of the txt file i have which I use awk against sample file testval,USA,loc2,testing02 testval1,GB,loc4,testing01 awk statement awk -F , '{print $2,$3}' USA loc2 GB loc4 I need a method where... (6 Replies)
Discussion started by: duckeggs01
6 Replies

4. Shell Programming and Scripting

Combining columns from multiple files into one single output file

Hi, I have 3 files with one column value as shown File: a.txt ------------ Data_a1 Data_a2 File2: b.txt ------------ Data_b1 Data_b2 Data_b3 Data_b4 File3: c.txt ------------ Data_c1 Data_c2 Data_c3 Data_c4 Data_c5 (6 Replies)
Discussion started by: vfrg
6 Replies

5. Shell Programming and Scripting

Multiple records need to convert UNIXtime to human readable datatime and all output in one format

Hello Experts, Below is the record i have: sample data attached I want this record of each row to be in single line and there are multiple rowise unixtime mentioned e.g 11996327 , This needs to be converted to Human readdable data and time from multiple rows Can you help me , it will be... (10 Replies)
Discussion started by: manishK
10 Replies

6. Shell Programming and Scripting

How to format output in columns by appending multi lines one by one?

Hi, I need to display output in below format Customer : Apr 24 16:31 Customer_Name_111121.txt |---Space---|Apr 24 16:32 Customer_Name _111121. txt |---Space---|Apr 24 16:34 Customer_Name_111112. txt |---Space---|Apr 24 16:35 Customer_Name _222223. txt |---Space---|Apr 24 16:37... (8 Replies)
Discussion started by: ketanraut
8 Replies

7. Shell Programming and Scripting

Reading multiple values from multiple lines and columns and setting them to unique variables.

Hello, I would like to ask for help with csh script. An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
Discussion started by: FMMOLA
7 Replies

8. Shell Programming and Scripting

Sum of columns and format the output

Input file: 011100020100 0.00 1 20000 30000 20000 011110000025 0.00 1 000 240000 10000 011100020100 0.00 1 200000 2324000 403500 032200030025 0.00 1 2077500 3077500 250000 032200030025 0.00 1 2565000 25536400 320000 022220000005 0.00 1 10000 300000 300000 022220000005 0.00 1 200050... (7 Replies)
Discussion started by: vinus
7 Replies

9. Shell Programming and Scripting

Join two files combining multiple columns and produce mix and match output

I would like to join two files when two columns in each file matches with each other and then produce an output when taking multiple columns. Like I have file A 1234,ABCD,23,JOHN,NJ,USA 2345,ABCD,24,SAM,NY,USA 5678,GHIJ,24,TOM,NY,USA 5678,WXYZ,27,MAT,NJ,USA and file B ... (2 Replies)
Discussion started by: mady135
2 Replies

10. UNIX for Dummies Questions & Answers

Read in Multiple log files and output selected variables and values to cvs file

I have several problems with my problems: I hope you can help me. 1) the If else statement I am getting an error message. My syntax must be incorrect because the entire statement is throwing an error. For example in filew.log if these items don't exist Memsize, SASFoundation and also if... (0 Replies)
Discussion started by: dellanicholson
0 Replies
MYSQLI_STMT.BIND_PARAM(3)						 1						 MYSQLI_STMT.BIND_PARAM(3)

mysqli_stmt::bind_param - Binds variables to a prepared statement as parameters

       Object oriented style

SYNOPSIS
bool mysqli_stmt::bind_param (string $types, mixed &$var1, [mixed &$...]) DESCRIPTION
Procedural style bool mysqli_stmt_bind_param (mysqli_stmt $stmt, string $types, mixed &$var1, [mixed &$...]) Bind variables for the parameter markers in the SQL statement that was passed to mysqli_prepare(3). Note If data size of a variable exceeds max. allowed packet size (max_allowed_packet), you have to specify b in $types and use mysqli_stmt_send_long_data(3) to send the data in packets. Note Care must be taken when using mysqli_stmt_bind_param(3) in conjunction with call_user_func_array(3). Note that mysqli_stmt_bind_param(3) requires parameters to be passed by reference, whereas call_user_func_array(3) can accept as a parameter a list of variables that can represent references or values. PARAMETERS
o $ stmt -Procedural style only: A statement identifier returned by mysqli_stmt_init(3). o $types - A string that contains one or more characters which specify the types for the corresponding bind variables: Type specification chars +----------+---------------------------------------------------+ |Character | | | | | | | Description | | | | +----------+---------------------------------------------------+ | i | | | | | | | corresponding variable has type integer | | | | | d | | | | | | | corresponding variable has type double | | | | | s | | | | | | | corresponding variable has type string | | | | | b | | | | | | | corresponding variable is a blob and will be sent | | | in packets | | | | +----------+---------------------------------------------------+ o $var1 - The number of variables and length of string $types must match the parameters in the statement. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Object oriented style <?php $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'world'); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $stmt = $mysqli->prepare("INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)"); $stmt->bind_param('sssd', $code, $language, $official, $percent); $code = 'DEU'; $language = 'Bavarian'; $official = "F"; $percent = 11.2; /* execute prepared statement */ $stmt->execute(); printf("%d Row inserted. ", $stmt->affected_rows); /* close statement and connection */ $stmt->close(); /* Clean up table CountryLanguage */ $mysqli->query("DELETE FROM CountryLanguage WHERE Language='Bavarian'"); printf("%d Row deleted. ", $mysqli->affected_rows); /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php $link = mysqli_connect('localhost', 'my_user', 'my_password', 'world'); /* check connection */ if (!$link) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $stmt = mysqli_prepare($link, "INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)"); mysqli_stmt_bind_param($stmt, 'sssd', $code, $language, $official, $percent); $code = 'DEU'; $language = 'Bavarian'; $official = "F"; $percent = 11.2; /* execute prepared statement */ mysqli_stmt_execute($stmt); printf("%d Row inserted. ", mysqli_stmt_affected_rows($stmt)); /* close statement and connection */ mysqli_stmt_close($stmt); /* Clean up table CountryLanguage */ mysqli_query($link, "DELETE FROM CountryLanguage WHERE Language='Bavarian'"); printf("%d Row deleted. ", mysqli_affected_rows($link)); /* close connection */ mysqli_close($link); ?> The above examples will output: 1 Row inserted. 1 Row deleted. SEE ALSO
mysqli_stmt_bind_result(3), mysqli_stmt_execute(3), mysqli_stmt_fetch(3), mysqli_prepare(3), mysqli_stmt_send_long_data(3), mysqli_stmt_errno(3), mysqli_stmt_error(3). PHP Documentation Group MYSQLI_STMT.BIND_PARAM(3)
All times are GMT -4. The time now is 11:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy