Sponsored Content
Top Forums Shell Programming and Scripting Awk/sed/cut to filter out records from a file based on criteria Post 302999767 by vgersh99 on Tuesday 27th of June 2017 04:47:51 PM
Old 06-27-2017
put in a file and attach it to the thread.
The current implementation is based on you "mock-up" and might not be relevant at all to the issue at hand.
This User Gave Thanks to vgersh99 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Selecting records from file on criteria.

Can I have 2 files as in input to the awk command? Situation is somewhat below, File A contains number & value delimited by a space. File B contains number as a part of a line. I am not supposed to retrieve more than 1 number from a line. If number from file B matches with number from... (7 Replies)
Discussion started by: videsh77
7 Replies

2. UNIX for Dummies Questions & Answers

Select records based on search criteria on first column

Hi All, I need to select only those records having a non zero record in the first column of a comma delimited file. Suppose my input file is having data like: "0","01/08/2005 07:11:15",1,1,"Created",,"01/08/2005" "0","01/08/2005 07:12:40",1,1,"Created",,"01/08/2005"... (2 Replies)
Discussion started by: shashi_kiran_v
2 Replies

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

4. Shell Programming and Scripting

awk - splitting 1 large file into multiple based on same key records

Hello gurus, I am new to "awk" and trying to break a large file having 4 million records into several output files each having half million but at the same time I want to keep the similar key records in the same output file, not to exist accross the files. e.g. my data is like: Row_Num,... (6 Replies)
Discussion started by: kam66
6 Replies

5. Shell Programming and Scripting

Filter/remove duplicate .dat file with certain criteria

I am a beginner in Unix. Though have been asked to write a script to filter(remove duplicates) data from a .dat file. File is very huge containig billions of records. contents of file looks like 30002157,40342424,OTC,mart_rec,100, ,0 30002157,40343369,OTC,mart_rec,95, ,0... (6 Replies)
Discussion started by: mukeshguliao
6 Replies

6. Shell Programming and Scripting

Extract error records based on specific criteria from Unix file

Hi, I look for a awk one liner for below issue. input file ABC 1234 abc 12345 ABC 4567 678 XYZ xyz ght 678 ABC 787 yyuu ABC 789 7890 777 zxr hyip hyu mno uii 678 776 ABC ty7 888 All lines should be started with ABC as first field. If a record has another value for 1st... (7 Replies)
Discussion started by: ratheesh2011
7 Replies

7. Shell Programming and Scripting

Filter records based on 2nd file

Hello, I want to filter records of a file if they fall in range associated with a second file. First the chr number (2nd col of 1st file and 1st col of 2nd file) needs to be matched. Then if the 3rd col of the first file falls within any of the ranges specified by the 2nd and 3rd cols , then... (4 Replies)
Discussion started by: ritakadm
4 Replies

8. Shell Programming and Scripting

awk to print specific line in file based on criteria

In the file below I am trying to extract a specific instance of path, if the adjacent plugin": "/rundb/api/v1/plugin/49/. Thank you :). file "path": "/results/analysis/output/Home/Auto_user_S5-00580-4-Medexome_65_028/plugin_out/FileExporter_out.52", "plugin": "/rundb/api/v1/plugin/49/",... (8 Replies)
Discussion started by: cmccabe
8 Replies

9. Shell Programming and Scripting

awk to filter file based on seperate conditions

The below awk will filter a list of 30,000 lines in the tab-delimited file. What I am having trouble with is adding a condition to SVTYPE=CNV that will only print that line if CI= must be >.05 . The other condition to add is if SVTYPE=Fusion, then in order to print that line READ_COUNT must... (3 Replies)
Discussion started by: cmccabe
3 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
Mock(3pm)						  LogReport's Lire Documentation						 Mock(3pm)

NAME
Lire::Test::Mock - Create mock object SYNOPSIS
use Lire::Report; use Lire::Test::Mock; use Lire::DlfResult; my $mock = new Lire::Test::Mock( 'Lire::Report' ); $mock->set_result( 'timestamp', $time ); $mock->timestamp(); # will return $time $mock->get_calls(); # [ 'timestamp' ] $mock->get_invocation( 'timestamp', 0 ); # [ $mock ] DESCRIPTION
This class makes it easy to defined mock objects. Mock objects are objects which offers the same interface than another object but which do not share its functionality. This makes it easier to test objects which requires fixtures which have lots of dependencies. The mock object can be used to collect information about calls made on the object. Returns value for such method invocation can also be specified. new( $class, 'method' => $result, 'method' => $result ) Creates a new mock object that will wrap $class. Any other keyword arguments will be use to initialize the result of methods call. See set_result() for information on how this works. new_proxy( $class, @constructor_params ) This creates mock object which for the base $class. A proxy mock object will still monitor calls to the object but the real methods will be invoked, unless a result was specified using set_result(). Any remaining parameters will be passed to the new() method which should be defined in the class. new_proxy( $instance ) Makes a Lire::Test::Mock object which is a clone of $instance. is_proxy() Returns whether this mock object will proxy to the real methods when no results was defined for a specific method. get_calls() Returns an array reference containing all the methods called on the object. invocation_count( $method ) Returns the number of time $method was called. get_invocation( $method, $index ) Returns the parameter that were given when method $method was called. set_result( method => $result, ... ) This assign the result $result to $method. If $result is a code reference, it will be invoked with the same argument than the method to compute the result. USING MOCK FACTORIES
Sometime, it is not possible to instatiate a proxy or mock object during fixture setup. This will usually happen when the object which we want to track access to is instantiated by the method under test. In these cases, one can use the set_mock_factory() class method to change the factory method to one that will return a proxy instance instead of a real instance. One should call reset_factories() during tear_down() so that the real factory method become directly accessible once again. set_mock_factory( $class, %results ) Make the new() method of package $class returns proxy Lire::Test::Mock instance. The created instances will be accessible through the mock_instances() method. Any other argument will be passed to the set_result() method when the mock instance is created. mock_instances( $class ) Returns an array reference containing all the instance that were created by the installed mock factory in $class. This method will throw an exception if now mock factory was installed for class $class. reset_factories() Removes all mock factories that were set up using set_mock_factory(). SEE ALSO
Test::Unit::TestCase(3pm) VERSION
$Id: Mock.pm,v 1.5 2006/07/23 13:16:32 vanbaal Exp $ AUTHORS
Francis J. Lacoste <flacoste@logreport.org> COPYRIGHT
Copyright (C) 2004 Stichting LogReport Foundation LogReport@LogReport.org This file is part of Lire. Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 Mock(3pm)
All times are GMT -4. The time now is 06:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy