delete rows with a criteria


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers delete rows with a criteria
# 8  
Old 04-27-2012
Thanks a lot to everyone!
I am also interested in getting a similar output but now only output the lines where the number of zeros in each row (starting from column 3) is equal or less than 5% of the total numbers per line (also starting only at column 3).

Thanks in advance
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete duplicate row based on criteria

Hi, I have an input file as shown below: 20140102;13:30;FR-AUD-LIBOR-1W;2.495 20140103;13:30;FR-AUD-LIBOR-1W;2.475 20140106;13:30;FR-AUD-LIBOR-1W;2.495 20140107;13:30;FR-AUD-LIBOR-1W;2.475 20140108;13:30;FR-AUD-LIBOR-1W;2.475 20140109;13:30;FR-AUD-LIBOR-1W;2.475... (2 Replies)
Discussion started by: shash
2 Replies

2. Shell Programming and Scripting

Rows to Columns with match criteria

Hello Friends, I have a input file having hundreds of rows. I want them to translate in to columns if column 1 is same. Input data: zp06 xxx zp06 rrr zp06 hhh zp06 aaa zp06 ggg zp06 qwer zp06 ser zl11 old3 zl11 old4 zl11 old5 zl11 old6 zl11 old7 zm14 luri zm14 body zm14 ucp (9 Replies)
Discussion started by: suresh3566
9 Replies

3. UNIX for Dummies Questions & Answers

How to delete rows?

I have an Output file which has the result YYYY 95,77 YYYY YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY 95 YYYY YYYY YYYY YYYY I would like to display the above along with a single line with above info. Final output should be YYYY 95 (3 Replies)
Discussion started by: priyanka.premra
3 Replies

4. Shell Programming and Scripting

Need To Delete Lines Based On Search Criteria

Hi All, I have following input file. I wish to retain those lines which match multiple search criteria. The search criteria is stored in a variable seperated from each other by comma(,). SEARCH_CRITERIA = "REJECT, DUPLICATE" Input File: ERROR,MYFILE_20130214_11387,9,37.75... (3 Replies)
Discussion started by: angshuman
3 Replies

5. Shell Programming and Scripting

delete the same rows

each individual (row) has genotype expressed for each SNP (column) file1.txt 1 1 A G A T G T A A A A A A A A A A A A A A A A A A A A A 2 2 G A A A A A A A A A A A A A A A A A A A A A A A A A A 3 3 A A A A A A A A A A A A A A A A A A A A A A A A A A A 4 4 G A G T A T A A A A A A A A A A A... (3 Replies)
Discussion started by: johnkim0806
3 Replies

6. Shell Programming and Scripting

pull out rows with specific criteria

Hi, I have a file with multiple columns and for column 5 I want to extract that row into another file if it is equal to or greater than a certain value. For example: FAR 4 5 7 LOP GAT 3 3 3 POL I want values that are greater than 5 for column 4. So the final file will look like... (1 Reply)
Discussion started by: phil_heath
1 Replies

7. Shell Programming and Scripting

awk search & delete located criteria

Guys, I manages to get awk to search and print the files that I want to delete. However I am stuck on the delete portion. Here is the command that I am using to fins these files. find /usr/local/apache/conf/vhosts/ -type f | awk '/e$/' The output is perfect. The files look like so: ... (4 Replies)
Discussion started by: jaysunn
4 Replies

8. Shell Programming and Scripting

delete rows in a file based on the rows of another file

I need to delete rows based on the number of lines in a different file, I have a piece of code with me working but when I merge with my C application, it doesnt work. sed '1,'\"`wc -l < /tmp/fileyyyy`\"'d' /tmp/fileA > /tmp/filexxxx Can anyone give me an alternate solution for the above (2 Replies)
Discussion started by: Muthuraj K
2 Replies

9. Shell Programming and Scripting

Delete new lines based on search criteria

Hi all! A bit of background: I am trying to create a script that formats SQL statements. I have gotten so far as to add new lines based on certain match criteria like commas, keywords etc. In the process, I end up adding newlines where I don't want. For example: substr(colName, 1, 10)... (3 Replies)
Discussion started by: jayarkay
3 Replies

10. Shell Programming and Scripting

Selecting rows with a specific criteria

Hi, I want a UNIX command that can filter out rows with certain criteria. The file is tab deliminated. Row one is just a value. Basically what I want to do is select based on the name and character at the end (o). So lets lets say i want a row that has WashU and (o) then it would print... (2 Replies)
Discussion started by: phil_heath
2 Replies
Login or Register to Ask a Question
MAXDB_AFFECTED_ROWS(3)							 1						    MAXDB_AFFECTED_ROWS(3)

maxdb_affected_rows - Gets the number of affected rows in a previous MaxDB operation

       Procedural style

SYNOPSIS
int maxdb_affected_rows (resource $link) DESCRIPTION
Object oriented style int$maxdb->affected_rows () maxdb_affected_rows(3) returns the number of rows affected by the last INSERT, UPDATE, or DELETE query associated with the provided $link parameter. If this number cannot be determined, this function will return -1. Note For SELECT statements maxdb_affected_rows(3) works like maxdb_num_rows(3). The maxdb_affected_rows(3) function only works with queries which modify a table. In order to return the number of rows from a SELECT query, use the maxdb_num_rows(3) function instead. RETURN VALUES
An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records where updated for an UPDATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the number of rows affected can not be determined. EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } maxdb_report (MAXDB_REPORT_OFF); $maxdb->query("DROP TABLE mycustomer"); maxdb_report (MAXDB_REPORT_ERROR); /* Insert rows */ $maxdb->query("CREATE TABLE mycustomer AS SELECT * from hotel.customer"); printf("Affected rows (INSERT): %d ", $maxdb->affected_rows); $maxdb->query("ALTER TABLE mycustomer ADD Status int default 0"); /* update rows */ $maxdb->query("UPDATE mycustomer SET Status=1 WHERE cno > 50"); printf("Affected rows (UPDATE): %d ", $maxdb->affected_rows); /* delete rows */ $maxdb->query("DELETE FROM mycustomer WHERE cno < 50"); printf("Affected rows (DELETE): %d ", $maxdb->affected_rows); /* select all rows */ $result = $maxdb->query("SELECT title FROM mycustomer"); printf("Affected rows (SELECT): %d ", $maxdb->affected_rows); $result->close(); /* Delete table Language */ $maxdb->query("DROP TABLE mycustomer"); /* close connection */ $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); if (!$link) { printf("Can't connect to localhost. Error: %s ", maxdb_connect_error()); exit(); } maxdb_report (MAXDB_REPORT_OFF); maxdb_query($link,"DROP TABLE mycustomer"); maxdb_report (MAXDB_REPORT_ERROR); /* Insert rows */ maxdb_query($link, "CREATE TABLE mycustomer AS SELECT * from hotel.customer"); printf("Affected rows (INSERT): %d ", maxdb_affected_rows($link)); maxdb_query($link, "ALTER TABLE mycustomer ADD Status int default 0"); /* update rows */ maxdb_query($link, "UPDATE mycustomer SET Status=1 WHERE cno > 50"); printf("Affected rows (UPDATE): %d ", maxdb_affected_rows($link)); /* delete rows */ maxdb_query($link, "DELETE FROM mycustomer WHERE cno < 50"); printf("Affected rows (DELETE): %d ", maxdb_affected_rows($link)); /* select all rows */ $result = maxdb_query($link, "SELECT title FROM mycustomer"); printf("Affected rows (SELECT): %d ", maxdb_affected_rows($link)); maxdb_free_result($result); /* Delete table Language */ maxdb_query($link, "DROP TABLE mycustomer"); /* close connection */ maxdb_close($link); ?> The above example will output something similar to: Affected rows (INSERT): 15 Affected rows (UPDATE): 15 Affected rows (DELETE): 0 Affected rows (SELECT): 15 SEE ALSO
maxdb_num_rows(3), maxdb_info(3). PHP Documentation Group MAXDB_AFFECTED_ROWS(3)