Sponsored Content
Top Forums Shell Programming and Scripting Appending different columns of multiple files in awk Post 303005731 by looney on Sunday 22nd of October 2017 12:54:28 PM
Old 10-22-2017
@Aia Thanks for looking into it. As i said there is no logic , i have randomly selected different columns of different files. I know the code i wrote was not correct that is the reason i mentioned pseudo code just to make it understand. Perhaps it created more confusion. Smilie

@Scrutinizer Thanks , this is what i was looking for. So the magic lies in p1=1 p2=2 file1 p1=2 p2=3 file2 p1=3 p2=2 file3.
I don't know why thanks button is disable!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk 3 files to one based on multiple columns

Hi all, I have three files, one is a navigation file, one is a depth file and one is a file containing the measured field of gravity. The formats of the files are; navigation file: 2006 320 17 39 0 0 *nav 21.31542 -157.887 2006 320 17 39 10 0 *nav 21.31542 -157.887 2006 320 17 39 20 0... (2 Replies)
Discussion started by: andrealphus
2 Replies

2. Shell Programming and Scripting

appending several columns with awk and paste

Hello, I am trying to solve for a couple of hours now the following problem: I have n files and would like to add the third column of each file to a new file: temp1.txt 1 2 3 1 2 3 1 2 3 temp2.txt 1 2 4 1 2 4 1 2 4 1 2 4 temp3.txt (2 Replies)
Discussion started by: creamcheese
2 Replies

3. UNIX for Dummies Questions & Answers

Extracting columns from multiple files with awk

hi everyone! I already posted it in scripts, I'm sorry, it's doubled I'd like to extract a single column from 5 different files and put them together in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is: awk 'NR==FNR{a=$2; next}... (1 Reply)
Discussion started by: orcaja
1 Replies

4. Shell Programming and Scripting

Extracting columns from multiple files with awk

hi everyone! I'd like to extract a single column from 5 different files and put them together in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is: awk 'NR==FNR{a=$2; next} {print a, $2}' file1 file2 I added the file3, file4 and... (10 Replies)
Discussion started by: orcaja
10 Replies

5. Shell Programming and Scripting

Appending columns of two files using shell script

Hi, I am using ksh, I want to read one csv file and append the columns of another file with new column. My input file: col1,col2 --------- siri,886 satya,890 priya,850 Another file with the below date:(test.csv) col3 ----- 321 333 442 (1 Reply)
Discussion started by: siri_886
1 Replies

6. UNIX for Dummies Questions & Answers

Appending columns at the end of output using awk/sed

Hi , I have the below ouput, =====gopi===== assasassaa adsadsadsdsada asdsadsadasdsa sadasdsadsd =====kannan=== asdasdasd sadasddsaasd adasdd =====hbk=== asasasssa .... .. I want the output like as below, not able paste here correctly. (2 Replies)
Discussion started by: eeegopikannan
2 Replies

7. Shell Programming and Scripting

awk script to split file into multiple files based on many columns

So I have a space delimited file that I'd like to split into multiple files based on multiple column values. This is what my data looks like 1bc9A02 1 10 1000 FTDLNLVQALRQFLWSFRLPGEAQKIDRMMEAFAQRYCQCNNGVFQSTDTCYVLSFAIIMLNTSLHNPNVKDKPTVERFIAMNRGINDGGDLPEELLRNLYESIKNEPFKIPELEHHHHHH 1ku1A02 1 10... (9 Replies)
Discussion started by: viored
9 Replies

8. Shell Programming and Scripting

awk arrays comparing multiple columns across two files.

Hi, I'm trying to use awk arrays to compare values across two files based on multiple columns. I've attempted to load file 2 into an array and compare with values in file 1, but success has been absent. If anyone has any suggestions (and I'm not even sure if my script so far is on the right lines)... (4 Replies)
Discussion started by: hubleo
4 Replies

9. UNIX for Dummies Questions & Answers

Appending multiple files

I am trying to append multiple files in a directory cat /a/file1.txt /a/file2.txt /a/file3.txt /a/file4.txt > /a/file.txt Except file2 every other file is appending. I interchanged file names and ran the command. Whatever file repeating in the second position is missing in output... (6 Replies)
Discussion started by: eskay
6 Replies

10. Shell Programming and Scripting

Appending multiple files through UNIX

Hi All, I have requirement where multiple csv files are present in a directory and each file contains a header.I need to append the contents of all the files into one file by removing header. Once the data is merged in one file ,I need to remove duplicates on nth column to find out distinct... (2 Replies)
Discussion started by: STCET22
2 Replies
MYSQLI_STMT_BIND_RESULT(3)						 1						MYSQLI_STMT_BIND_RESULT(3)

mysqli_stmt::bind_result - Binds variables to a prepared statement for result storage

       Object oriented style

SYNOPSIS
bool mysqli_stmt::bind_result (mixed &$var1, [mixed &$...]) DESCRIPTION
Procedural style bool mysqli_stmt_bind_result (mysqli_stmt $stmt, mixed &$var1, [mixed &$...]) Binds columns in the result set to variables. When mysqli_stmt_fetch(3) is called to fetch data, the MySQL client/server protocol places the data for the bound columns into the speci- fied variables $var1, .... Note Note that all columns must be bound after mysqli_stmt_execute(3) and prior to calling mysqli_stmt_fetch(3). Depending on column types bound variables can silently change to the corresponding PHP type. A column can be bound or rebound at any time, even after a result set has been partially retrieved. The new binding takes effect the next time mysqli_stmt_fetch(3) is called. PARAMETERS
o $ stmt -Procedural style only: A statement identifier returned by mysqli_stmt_init(3). o $var1 - The variable to be bound. 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"); if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } /* prepare statement */ if ($stmt = $mysqli->prepare("SELECT Code, Name FROM Country ORDER BY Name LIMIT 5")) { $stmt->execute(); /* bind variables to prepared statement */ $stmt->bind_result($col1, $col2); /* fetch values */ while ($stmt->fetch()) { printf("%s %s ", $col1, $col2); } /* close statement */ $stmt->close(); } /* 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(); } /* prepare statement */ if ($stmt = mysqli_prepare($link, "SELECT Code, Name FROM Country ORDER BY Name LIMIT 5")) { mysqli_stmt_execute($stmt); /* bind variables to prepared statement */ mysqli_stmt_bind_result($stmt, $col1, $col2); /* fetch values */ while (mysqli_stmt_fetch($stmt)) { printf("%s %s ", $col1, $col2); } /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> The above examples will output: AFG Afghanistan ALB Albania DZA Algeria ASM American Samoa AND Andorra SEE ALSO
mysqli_stmt_get_result(3), mysqli_stmt_bind_param(3), mysqli_stmt_execute(3), mysqli_stmt_fetch(3), mysqli_prepare(3), mysqli_stmt_pre- pare(3), mysqli_stmt_init(3), mysqli_stmt_errno(3), mysqli_stmt_error(3). PHP Documentation Group MYSQLI_STMT_BIND_RESULT(3)
All times are GMT -4. The time now is 08:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy