Sponsored Content
Top Forums Shell Programming and Scripting Filter records based on 2nd file Post 302875157 by tukuyomi on Monday 18th of November 2013 04:03:08 PM
Old 11-18-2013
Try also this awk code as well :
Code:
awk 'NR==FNR{A[++i,1]=$1;A[i,2]=$2;A[i,3]=$3;next}
{j=0;while(j++<i)if(($2==A[j,1])&&($3>=A[j,2])&&($3<=A[j,3]))print}
' filterfile datafile

This User Gave Thanks to tukuyomi For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

filter out all the records which are having space in the 8th filed of my file

I have a file which is having fileds separtaed by delimiter. Ex: C;4498;qwa;cghy;;;;40;;222122 C;4498;sample;city;;;;34 2;;222123 C;4498;qwe;xcbv;;;;34-2;;222124 C;4498;jj;sffz;;;;41;;222120 C;4498;eert;qwq;;;;34 A;;222125 C;4498;jj;szxzzd;;;;34;;222127 out of these records I... (3 Replies)
Discussion started by: indusri
3 Replies

2. Shell Programming and Scripting

Filter records in a file using AWK

I want to filter records in one of my file using AWK command (or anyother command). I am using the below code awk -F@ '$1=="0003"&&"$2==20100402" print {$0}' $INPUT > $OUTPUT I want to pass the 0003 and 20100402 values through a variable. How can I do this? Any help is much... (1 Reply)
Discussion started by: gpaulose
1 Replies

3. 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

4. UNIX for Dummies Questions & Answers

Filter records in a huge text file from a filter text file

Hi Folks, I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file. bash scripting is what i need. Data.txt Name OrderID Quantity Sam 123 300 Jay 342 498 Kev 78 2500 Sam 420 50 Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies

5. Shell Programming and Scripting

Shell script to filter records in a zip file that contains matching columns from another file

Not sure if this is the correct forum for this question. I have two files. file1.zip, file2 Input: file1.zip col1, col2 , col3 a , b , 0:0:0:0:0:c436:9346:d40b x, y, 0:0:0:0:0:880:39f9:c9a7 m, n , 0:0:0:0:0:80c7:9161:fe00 file2.txt col1 c4:36:93:46:d4:0b... (1 Reply)
Discussion started by: anil.v
1 Replies

6. Shell Programming and Scripting

Filter tab file based on column value

Hello I have a tab text file with many columns and have to filter rows ONLY if column 22 has the value of '0', '1', '2' or '3' (out of 0-5). If Column 22 has value '0','1', '2' or '3' (highlighted below), then remove anything less than 10 and greater 100 (based on column 5) AND remove anything... (1 Reply)
Discussion started by: nans
1 Replies

7. Shell Programming and Scripting

Awk/sed/cut to filter out records from a file based on criteria

I have two files and would need to filter out records based on certain criteria, these column are of variable lengths, but the lengths are uniform throughout all the records of the file. I have shown a sample of three records below. Line 1-9 is the item number "0227546_1" in the case of the first... (15 Replies)
Discussion started by: MIA651
15 Replies

8. 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

9. Shell Programming and Scripting

CSV File:Filter duplicate records from column1 & another column having unique record

Hi Experts, I have csv file with 30, 40 columns Pasting just 2 column for problem description. Need to print error if below combination is not present in file check for column-1 (DocumentNumber) and filter columns where value in DocumentNumber field is same. For all such rows, the field... (7 Replies)
Discussion started by: as7951
7 Replies

10. UNIX for Beginners Questions & Answers

Filter records from a log file based on timestamp

Dear Experts, I have a log file that contains a timestamp, I would like to filter record from that file based on timestamp. For example refer below file - cat sample.txt Jan 19 20:51:48 mukul-Vostro-14-3468 systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)... (6 Replies)
Discussion started by: mukulverma2408
6 Replies
NGRAPH(1)						      General Commands Manual							 NGRAPH(1)

NAME
Ngraph - creating scientific 2-dimensional graphs SYNOPSIS
ngraph [options] [data file(s) or ngp file] DESCRIPTION
Ngraph is the program to create scientific 2-dimensional graphs for researchers and engineers. Graphs can be exported to PostScript, SVG, PNG or PDF format. OPTIONS
Command line options are: -L file load ngp file -x column data column for the x axis -y column data column for the y axis -X use X axis as the x axis -Y use Y axis as the y axis -U use U axis as the x axis -R use R axis as the y axis -d {mark | line | polygon | curve | diagonal | arrow | rectangle | rectangle_fill | rectangle_solid_fill | errorbar_x | errorbar_y | stair- case_x | staircase_y | bar_x | bar_y | bar_fill_x | bar_fill_y | bar_solid_fill_x | bar_solid_fill_y | fit} specify plot type -m type specify mark type (0-89) -o size specify mark size -l style specify line style -w width specify line width -CR n specify red component of the 1st plot color (0-255) -CG n specify green component of the 1st plot color (0-255) -CB n specify blue component of the 1st plot color (0-255) -cr n specify red component of the 2nd plot color (0-255) -cg n specify green component of the 2nd plot color (0-255) -cb n specify blue component of the 2nd plot color (0-255) -s line specify number of the head skip -r step specify number of the read step -f line specify number of the final line -vx n neighbor average of the x data -vy n neighbor average of the y data -mx formula specify math transformation for the x data -my formula specify math transformation for the y data -ex {linear | log | inverse | MJD} specify scale type of the x axis -ey {linear | log | inverse | MJD} specify scale type of the y axis -minx value specify minimum value of x axis -maxx value specify maximum value of x axis -incx value specify increment value of x axis -miny value specify minimum value of y axis -maxy value specify maximum value of y axis -incy value specify increment value of y axis -g load settings from data file -png file convert ngp file to PNG format -pdf file convert ngp file to PDF format -ps file convert ngp file to PostScript format -eps file convert ngp file to Encapsulated PostScript format -svg file convert ngp file to SVG format -gra file convert ngp file to GRA format -dialog show print dialog (with -p option) -p file print ngp file -n output ngp-file to stdout -h, --help show help message -v, --version show version of Ngraph -V, --VERSION show detail information about Ngraph FILES
${HOME}/.Ngraph/Ngraph.nsc start up script ${HOME}/.Ngraph/Ngraph.ini configuration file ${HOME}/.Ngraph/Ngraph.ngp default graph AUTHORS
Satoshi ISHIZAKA Hiroyuki Ito <ZXB01226@nifty.com> SEE ALSO
ngp2(1) COPYRIGHT
Copyright (C) 2003 Satoshi ISHIZAKA Copyright (C) 2008-2011 Hiroyuki Ito 4th Berkeley Distribution Local NGRAPH(1)
All times are GMT -4. The time now is 12:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy