Sponsored Content
Top Forums Shell Programming and Scripting Delete records within a file upon a condition Post 302773803 by Yoda on Thursday 28th of February 2013 05:12:03 PM
Old 02-28-2013
Code:
awk ' NR == 1 {
                c1 = $2
                c2 = $3
                p  = $1
                next

} p == $1 {
                d1 = c1 - $2
                d2 = c1 - $3

                d3 = c2 - $2
                d4 = c2 - $3

                d1 = (d1 < 0)?d1*-1:d1
                d2 = (d2 < 0)?d2*-1:d2
                d3 = (d3 < 0)?d3*-1:d3
                d4 = (d4 < 0)?d4*-1:d4

                if ( d1 > 300 && d2 > 300 && d3 > 300 && d4 > 300 )
                        print
} p != $1 {
                c1 = $2
                c2 = $3
                p  = $1
                print
} ' input

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete records from a file

I have a big file with "|" delimiter. I want to delete all the records that have 'abc' in the 2nd field. How can i do that? I am not abe to open it in VI that is why i need to do it from outside. Please suggest (6 Replies)
Discussion started by: dsravan
6 Replies

2. Shell Programming and Scripting

Delete Duplicate records from a tilde delimited file

Hi All, I want to delete duplicate records from a tilde delimited file. Criteria is considering the first 2 fields, the combination of which has to be unique, below is a sample of records in the input file 1620000010338~2446694087~0~20061130220000~A00BCC1CT... (5 Replies)
Discussion started by: irshadm
5 Replies

3. UNIX for Dummies Questions & Answers

Use records from one file to delete records in another file

file_in_1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 file_in_2: 9 10 11 12 21 22 23 24 1 2 3 4 17 18 19 20 file_out: (5 Replies)
Discussion started by: kenneth.mcbride
5 Replies

4. UNIX for Dummies Questions & Answers

How can you delete records in a file matching a pattern?

I am curious if the following can be done in a file in unix. Let's say I have a flat file with the following data AAA,12,2,,,, BBB,3,1,,,, CCC,,,,, DDD,2,,,,, SQQ,,,,, ASJ,,3,5 I only want to capture the data with values into a new file. If the data contains the pattern ,,,,, as in... (2 Replies)
Discussion started by: mode09
2 Replies

5. Shell Programming and Scripting

Apply condition on fixed width file and filter records

Dear members.. I have a fixed width file. Requirement is as below:- 1. Scan each record from this fixed width file 2. Check for value under field no "6" equals to "ABC". If yes, then filter this record into the output file Please suggest a unix command to achieve this, my guess awk might... (6 Replies)
Discussion started by: sureshg_sampat
6 Replies

6. Shell Programming and Scripting

Need unix commands to delete records from one file if the same record present in another file...

Need unix commands to delete records from one file if the same record present in another file... just like join ... if the record present in both files.. delete from first file or delete the particular record and write the unmatched records to new file.. tried with grep and while... (6 Replies)
Discussion started by: msathees
6 Replies

7. UNIX for Dummies Questions & Answers

Delete records from a big file based on some condition

Hi, To load a big file in a table,I have a make sure that all rows in the file has same number of the columns . So in my file if I am getting any rows which have columns not equal to 6 , I need to delete it . Delimiter is space and columns are optionally enclosed by "". This can be ... (1 Reply)
Discussion started by: hemantraijain
1 Replies

8. Shell Programming and Scripting

Delete File in a Directory Using a Condition

Hello, I have a directory with many files whose creation time is distributed all over the day. I need ANY 20 files per hour. So, I need 20 files for hour 00 20 files for hour 01 ... 20 files for hour 23 What I have done so far is not great. Here is the code: # get the Month a=`echo... (8 Replies)
Discussion started by: shekhar2010us
8 Replies

9. Shell Programming and Scripting

Delete lines from file based on condition

I want to keep last 2 days data from a file and want to delete others data from the file. Please help me. Sample Input # cat messages-2 Apr 15 11:25:03 test1 kernel: imklog 4.6.2, log source = /proc/kmsg started. Apr 15 11:25:03 test1 rsyslogd: (re)start Apr 16 19:42:03 test1 kernel:... (2 Replies)
Discussion started by: makauser
2 Replies

10. Shell Programming and Scripting

Filter duplicate records from csv file with condition on one column

I have csv file with 30, 40 columns Pasting just three column for problem description I want to filter record if column 1 matches CN or DN then, check for values in column 2 if column contain 1235, 1235 then in column 3 values must be sequence of 2345, 2345 and if column 2 contains 6789, 6789... (5 Replies)
Discussion started by: as7951
5 Replies
Gnome(3)						User Contributed Perl Documentation						  Gnome(3)

NAME
Gnome - Perl module for the Gnome libraries SYNOPSIS
use Gnome; Gnome->init('myapp'); my $app = new Gnome::App("myapp", "myapp window title"); $app->create_menus({type => 'subtree', label => '_File', subtree => [ ['item', '_Quit', undef, sub {exit}, 'stock', 'Quit'], ]}); my $canvas = new Gnome::Canvas; $canvas->set_scroll_region(0, 0, 300, 300); $canvas->set_usize(300, 300); $canvas->root->new($canvas->root, 'Rect', x1 => 10, y1 => 10, x2 => 150, y2 => 250, fill_color => '#0f0ef2', outline_color => 'black'); $app->set_contents($canvas); $app->show_all; Gtk->main; DESCRIPTION
The Gtk module allows Perl access to the widgets and other facilities in the Gnome libraries. You can find more information about Gnome on http://www.gnome.org. The Perl binding tries to follow the C interface as much as possible, providing at the same time a fully object ori- ented interface and Perl-style calling conventions. You will find the reference documentation for the Gnome module in the "Gnome::reference" manpage. More information can be found on http://gtkperl.org. AUTHOR
Kenneth Albanowski, Paolo Molaro SEE ALSO
perl(1), Gtk(3pm), Gtk::reference(3pm), Gnome::reference(3pm) perl v5.8.0 2001-06-26 Gnome(3)
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy