Ok.So your sure that the file customer_file.txt contains only one line.. Or many lines with same number of columns..? One little bug is that there is no echo statement in the else part.
Hi,
I want to write a shell script which increments a particular column in a row from a text file and then adds another row below the current row with the incremented value .
For Eg .
if the input file has a row :
abc xyz lmn 89 lm nk o p
I would like the script to create something like... (9 Replies)
hi, I'm totally new to this forum and to awk.
I have what I thought was a simple problem, but I can't get anything to work. Here is an example input file:
3.85 4018.4
3.9 4068.4
3.95 4082.9
4 4099.7
# Property:.......etc.
0 4733.3
0.05 4659.7
0.1 4585.6
0.15 4466.2
Two... (2 Replies)
Dear linux experts,
I'd like to ask for your support, I've read some posts in this forum about files comparison but haven't found what I'm looking for. I need to create a sequential script to compare row-by-row one file with 34 similar files but without success so far. This is what I get:
... (2 Replies)
Hi,
I need help on doing the below thing in shell script.
I have a file with millions of rows called "abc.txt". i have another file with millions of rows called "xyz.txt".
I would like to do the below operation.
Open the abc.txt, read the first line, do some operations on the column... (2 Replies)
Hello Everyone,
My issue is that I want to traverse a database table row by row and do some action on the value retrieved in each row.
I have gone through a lot of shell script questions/posts. I could find row by row traversal of a file but not a database table.
Please help.
Thanks &... (5 Replies)
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here.
Original File 1:
... (36 Replies)
Hi ALL,
We have requirement in a file, i have multiple rows.
Example below:
Input file rows
01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212
01,1,102319,0,1,80,20,U,1,241,00000059420000006021
I need my output file should be as mentioned below. Last field should split for... (4 Replies)
This is a question that is related to one I had last August when I was trying to sort/merge two files by millsecond time column (in this case column 6).
The script (below) that helped me last august by RudiC solved the puzzle of sorting/merging two files by time, except it gets lost when the... (0 Replies)
Discussion started by: aachave1
0 Replies
LEARN ABOUT PHP
sqlsrv_fetch
SQLSRV_FETCH(3)SQLSRV_FETCH(3)sqlsrv_fetch - Makes the next row in a result set available for readingSYNOPSIS
mixed sqlsrv_fetch (resource $stmt, [int $row], [int $offset])
DESCRIPTION
Makes the next row in a result set available for reading. Use sqlsrv_get_field(3) to read the fields of the row.
PARAMETERS
o $stmt
- A statement resource created by executing sqlsrv_query(3) or sqlsrv_execute(3).
o $row
- The row to be accessed. This parameter can only be used if the specified statement was prepared with a scrollable cursor. In
that case, this parameter can take on one of the following values:
oSQLSRV_SCROLL_NEXT
oSQLSRV_SCROLL_PRIOR
oSQLSRV_SCROLL_FIRST
oSQLSRV_SCROLL_LAST
oSQLSRV_SCROLL_ABSOLUTE
oSQLSRV_SCROLL_RELATIVE
o $offset
- Specifies the row to be accessed if the row parameter is set to SQLSRV_SCROLL_ABSOLUTE or SQLSRV_SCROLL_RELATIVE. Note that the
first row in a result set has index 0.
RETURN VALUES
Returns TRUE if the next row of a result set was successfully retrieved, FALSE if an error occurs, and NULL if there are no more rows in
the result set.
EXAMPLES
Example #1
sqlsrv_fetch(3) example
The following example demonstrates how to retrieve a row with sqlsrv_fetch(3) and get the row fields with sqlsrv_get_field(3).
<?php
$serverName = "serverNamesqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT Name, Comment
FROM Table_1
WHERE ReviewID=1";
$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
// Make the first (and in this case, only) row of the result set available for reading.
if( sqlsrv_fetch( $stmt ) === false) {
die( print_r( sqlsrv_errors(), true));
}
// Get the row fields. Field indeces start at 0 and must be retrieved in order.
// Retrieving row fields by name is not supported by sqlsrv_get_field.
$name = sqlsrv_get_field( $stmt, 0);
echo "$name: ";
$comment = sqlsrv_get_field( $stmt, 1);
echo $comment;
?>
SEE ALSO sqlsrv_get_field(3), sqlsrv_fetch_array(3), sqlsrv_fetch_object(3).
PHP Documentation Group SQLSRV_FETCH(3)