Sponsored Content
Full Discussion: row Comparison
Top Forums Shell Programming and Scripting row Comparison Post 302501620 by michaelrozar17 on Friday 4th of March 2011 04:15:33 AM
Old 03-04-2011
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.
Code:
if [ $Total_col_count  -eq 10 -a $Temp_var  ==  $head_file ]
then 
        echo "matched"
else 
        echo "not matched"
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing the column for a row in a text file and adding another row

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)
Discussion started by: aYankeeFan
9 Replies

2. Shell Programming and Scripting

consecutive row comparison in awk (?)

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)
Discussion started by: ogga
2 Replies

3. Shell Programming and Scripting

Sequential comparison (one row with file and so on)

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)
Discussion started by: Gery
2 Replies

4. Shell Programming and Scripting

How to do row comparison in shell script

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)
Discussion started by: informsrini
2 Replies

5. UNIX for Dummies Questions & Answers

Shell Script: Traverse Database Table Row by Row

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)
Discussion started by: ahsan.asghar
5 Replies

6. Shell Programming and Scripting

Subtracting each row from the first row in a single column file using awk

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)
Discussion started by: ks_reddy
11 Replies

7. Shell Programming and Scripting

Add Row from First Row (Split Row)

HI Guys, I have Below Input :- RepigA_hteis522 ReptCfiEtrBsCll_aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 RepigA ReptCfiEtrBsCll hteis522 aofe MSL04_MSL2_A25_1A 0 9 MSL04_MSL2_A25_1B 0 9 MSL04_MSL2_A25_1C 0 9 Split Data in two first row... (2 Replies)
Discussion started by: pareshkp
2 Replies

8. UNIX for Beginners Questions & Answers

Keep only the closet match of timestamped row (include headers) from file1 to precede file2 row/s

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)
Discussion started by: aachave1
36 Replies

9. Shell Programming and Scripting

Splitting single row into multiple rows based on for every 10 digits of last field of the row

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)
Discussion started by: kotra
4 Replies

10. UNIX for Beginners Questions & Answers

Keep only the closet match of timestamped row (include headers) from file1 to precede file2 row/s

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
SQLSRV_FETCH(3) 														   SQLSRV_FETCH(3)

sqlsrv_fetch - Makes the next row in a result set available for reading

SYNOPSIS
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)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy