Sponsored Content
Top Forums Shell Programming and Scripting Find a blank field and replace values to NA Post 302847129 by Shenbaga.d on Monday 26th of August 2013 11:07:32 AM
Old 08-26-2013
HI,

i tried to fild the NA values and still finding to replace the fist col1 values to NA

Code:
awk -F\\t '{ if (NR == 1) { for (i=1;i<=NF;i++){if ($i=="col3") { c=i } } };if (NR != 1) {if ($c ~ /NA/ )' filename.tsv


Last edited by Scott; 08-26-2013 at 12:10 PM.. Reason: code tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find and replace a field in the last line

I have a file 'test.out' with contents: 1|1|10|10|I|asdf| 2|1|10|10|I|sdfg| 4|1|10|10|I|hgfj| 34|0|10|10|I|sdg| I want to modify the fifth column with value 'I' to 'A' for only the last line. Below is what I expect to see: 1|1|10|10|I|asdf| 2|1|10|10|I|sdfg| ... (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

2. Shell Programming and Scripting

finding field count escaping the blank values

Hi All I have a file.Below are few records of the file. sample.txt CPS,ES,843232910001,ESF81462,W N LINDSAY LTD,01674840629,09-FEB-2009,23-FEB-2009,CDR735,ALL CALLS,01674840629 CPS,ES,843232670001,ESF81462,W N LINDSAY LTD,01674840629,09-FEB-2009,23-FEB-2009,CDR734,ALL... (2 Replies)
Discussion started by: king007
2 Replies

3. Shell Programming and Scripting

Find top N values for field X based on field Y's value

I want to find the top N entries for a certain field based on the values of another field. For example if N=3, we want the 3 best values for each entry: Entry1 ||| 100 Entry1 ||| 95 Entry1 ||| 30 Entry1 ||| 80 Entry1 ||| 50 Entry2 ||| 40 Entry2 ||| 20 Entry2 ||| 10 Entry2 ||| 50... (1 Reply)
Discussion started by: FrancoisCN
1 Replies

4. Shell Programming and Scripting

Replace blank values for string using sed

Hi everyone, I was wondering how could from a file where each row is separated by tabulations, the row values where are in blank replace them by a string or value. My file has this form: 26/01/09 13:45:00 0 0 26/01/09 14:00:00 1495.601318 0 26/01/09 14:15:00 1495.601318 0 ... (4 Replies)
Discussion started by: tonet
4 Replies

5. Shell Programming and Scripting

Find and replace blank in the last field

Hi all, I have a huge file and I need to get ride of the fields 6-11 and replace the blanks in field 5 with a missing value(99999). 159,93848,5354,343,67898,45,677,5443,434,5545,45 677,45545,3522,244, 554,54344,3342,456, 344,43443,2344,444,23477... (12 Replies)
Discussion started by: GoldenFire
12 Replies

6. Shell Programming and Scripting

replace blank field in file 2 with content of file 1

Something like vlookup in excel, column 2 in file 2 is blank and should be replaced by column 2 in file 1 based on comparing column 1 in both files. file1 Code: 1234~abc~b~c~d~e~f~g~h~09/10/09 5678~def~b~c~d~e~f~g~h~12/06/10 8910~hij~b~c~d~e~f~g~h~03/28/13... (1 Reply)
Discussion started by: sigh2010
1 Replies

7. Shell Programming and Scripting

Replace a field where values are null in a file.

Hi, I've a pipe delimited file and wanted to replace the 3rd field to 099990 where the values are null. How can I achieve it using awk or sed. 20130516|00000061|02210|111554|03710|2|205069|SM APPL $80-100 RTL|S 20130516|00000061|02210|111554|03710|2|205069|SM APPL $80-100 RTL|S... (12 Replies)
Discussion started by: rudoraj
12 Replies

8. Shell Programming and Scripting

Find a blank field

Find a blank field Hi I have set of fields that have some blank values, how to find that and get its line noumbers in output file. Ex: Col1 col2 col3 11 ss 103 12 104 13 105 14 se 106 (2 Replies)
Discussion started by: Shenbaga.d
2 Replies

9. UNIX for Beginners Questions & Answers

How to replace the field values, which are greater than the specified value with TRUE?

I have a csv file as given below, org1 org2 org3 org4 org5 gene1 100 80 90 80 150 gene2 30 70 50 50 115 gene3 40 120 60 40 105 gene4 20 72 40 60 20 I need to replace the fields are having values greater than 100 with "TRUE". I used the following commands to replace... (6 Replies)
Discussion started by: dineshkumarsrk
6 Replies
MAXDB_STMT_BIND_RESULT(3)						 1						 MAXDB_STMT_BIND_RESULT(3)

maxdb_stmt_bind_result - Binds variables to a prepared statement for result storage

       Procedural style

SYNOPSIS
bool maxdb_stmt_bind_result (resource $stmt, mixed &$var1, [mixed &$...]) DESCRIPTION
Object oriented style bool maxdb_stmt::bind_result (mixed &$var1, [mixed &$...]) maxdb_stmt_bind_result(3) is used to associate (bind) columns in the result set to variables. When maxdb_stmt_fetch(3) is called to fetch data, the MaxDB client/server protocol places the data for the bound columns into the specified variables $var1, .... Note Note that all columns must be bound prior to calling maxdb_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 maxdb_stmt_fetch(3) is called. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } /* prepare statement */ if ($stmt = $maxdb->prepare("SELECT zip, name FROM hotel.city ORDER BY name")) { $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 */ $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (!$link) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } /* prepare statement */ if ($stmt = maxdb_prepare($link, "SELECT zip, name FROM hotel.city ORDER BY name")) { maxdb_stmt_execute($stmt); /* bind variables to prepared statement */ maxdb_stmt_bind_result($stmt, $col1, $col2); /* fetch values */ while (maxdb_stmt_fetch($stmt)) { printf("%s %s ", $col1, $col2); } /* close statement */ maxdb_stmt_close($stmt); } /* close connection */ maxdb_close($link); ?> The above example will output something similar to: 12203 Albany 60601 Chicago 60615 Chicago 45211 Cincinnati 33575 Clearwater 75243 Dallas 32018 Daytona Beach 33441 Deerfield Beach 48226 Detroit 90029 Hollywood 92714 Irvine 90804 Long Beach 11788 Long Island 90018 Los Angeles 70112 New Orleans 10019 New York 10580 New York 92262 Palm Springs 97213 Portland 60018 Rosemont 95054 Santa Clara 20903 Silver Spring 20005 Washington 20019 Washington 20037 Washington SEE ALSO
maxdb_stmt_bind_param(3), maxdb_stmt_execute(3), maxdb_stmt_fetch(3), maxdb_prepare(3), maxdb_stmt_prepare(3), maxdb_stmt_init(3), maxdb_stmt_errno(3), maxdb_stmt_error(3). PHP Documentation Group MAXDB_STMT_BIND_RESULT(3)
All times are GMT -4. The time now is 09:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy