Sponsored Content
Top Forums Shell Programming and Scripting Nawk script to compare records of a file based on a particular column. Post 302550217 by jayan_jay on Thursday 25th of August 2011 03:58:11 AM
Old 08-25-2011
you have missed the flower brackets.. corrected one..
Code:
$ nawk -F"|" '{ if (!a[$1]) {a[$1]; if ( $6!= "" ) { print $0 } } } ' inputfile
UM113570248|24-AUG-11|4|man1|RR211 Alert: Master Process failure |24-AUG-11
UM113570624|24-AUG-11|4|man1| Alert: Pattern 'E_DCLeDAOException' found |24-AUG-11
UM113569599|24-AUG-11|4|man1|RRWEB413 ChartsDCC RoadRunner App|OLTX_Iote6|24-AUG-11

 

10 More Discussions You Might Find Interesting

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

2. UNIX for Dummies Questions & Answers

Filtering records of a file based on a value of a column

Hi all, I would like to extract records of a file based on a condition. The file contains 47 fields, and I would like to extract only those records that match a certain value in one of the columns, e.g. COL1 COL2 COL3 ............... COL47 1 XX 45 ... (4 Replies)
Discussion started by: risk_sly
4 Replies

3. Shell Programming and Scripting

Compare files column to column based on keys

Here is my situation. I need to compare two tab separated files (diff is not useful since there could be known difference between files). I have found similar posts , but not fully matching.I was thinking of writing a shell script using cut and grep and while loop but after going thru posts it... (2 Replies)
Discussion started by: blackjack101
2 Replies

4. Shell Programming and Scripting

Removing duplicate records in a file based on single column

Hi, I want to remove duplicate records including the first line based on column1. For example inputfile(filer.txt): ------------- 1,3000,5000 1,4000,6000 2,4000,600 2,5000,700 3,60000,4000 4,7000,7777 5,999,8888 expected output: ---------------- 3,60000,4000 4,7000,7777... (5 Replies)
Discussion started by: G.K.K
5 Replies

5. Emergency UNIX and Linux Support

[Solved] Extract records based on a repeated column value

Hi guys, I need help in making a command to find some data. I have multiple files in which multiple records are present.. Each record is separated with a carriage return and in each record there are multiple fields with each field separated by "|" what i want is that I want to extract... (1 Reply)
Discussion started by: m_usmanayub
1 Replies

6. Shell Programming and Scripting

Removing duplicate records in a file based on single column explanation

I was reading this thread. It looks like a simpler way to say this is to only keep uniq lines based on field or column 1. https://www.unix.com/shell-programming-scripting/165717-removing-duplicate-records-file-based-single-column.html Can someone explain this command please? How are there no... (5 Replies)
Discussion started by: cokedude
5 Replies

7. Shell Programming and Scripting

Compare based on column value

Hi Experts, I want to compare 2 text files based on their column values text1 is like prd-1234 yes no yes yes prd-2345 no no no yes prd-6475 yes yes yes no and test 2 is prd-1234 no no no yes prd-2345 yes no no no desired out put as follows prd-1234 1 3 prd-235 1 4 basically it shows... (5 Replies)
Discussion started by: tijomonmathew
5 Replies

8. Shell Programming and Scripting

Compare two files based on column

Hi, I have two files roughly 1200 fields in length for each row, sorted on the 2nd field. I need to compare based on that 2nd column between file1 and file2 and print lines that exist in both files into separate files (I can't guarantee that every line in file1 is in file2). Example: File1: ... (1 Reply)
Discussion started by: origon
1 Replies

9. Shell Programming and Scripting

Compare two csv's with column based

Hi, I am having below two CSV's col_1,col_2,col_3 1,2,4 1,3,6 col_1,col_3,col2,col_5,col_6 1,2,3,4,5 1,6,3,,, I need to compare based on the columns where the mismatch is expected output col_1,col_2,col_3 1,2,4 (3 Replies)
Discussion started by: rohit_shinez
3 Replies

10. UNIX for Beginners Questions & Answers

Filtering records of a csv file based on a value of a column

Hi, I tried filtering the records in a csv file using "awk" command listed below. awk -F"~" '$4 ~ /Active/{print }' inputfile > outputfile The output always has all the entries. The same command worked for different users from one of the forum links. content of file I was... (3 Replies)
Discussion started by: sunilmudikonda
3 Replies
Bio::Symbol::Symbol(3pm)				User Contributed Perl Documentation				  Bio::Symbol::Symbol(3pm)

NAME
Bio::Symbol::Symbol - A biological symbol SYNOPSIS
use Bio::Symbol::Symbol; my $thymine = Bio::Symbol::Symbol->new(-name => 'Thy', -token=> 'T'); my $a = Bio::Symbol::Symbol->new(-token => 'A' ); my $u = Bio::Symbol::Symbol->new(-token => 'U' ); my $g = Bio::Symbol::Symbol->new(-token => 'G' ); my $M = Bio::Symbol::Symbol->new(-name => 'Met', -token => 'M', -symbols => [ $a, $u, $g ]); my ($name,$token) = ($a->name, $a->token); my @symbols = $a->symbols; my $matches = $a->matches; DESCRIPTION
Symbol represents a single token in the sequence. Symbol can have multiple synonyms or matches within the same Alphabet, which makes possible to represent ambiguity codes and gaps. Symbols can be also composed from ordered list other symbols. For example, codons can be represented by single Symbol using a compound Alphabet made from three DNA Alphabets. This module was implemented for the purposes of meeting the BSANE/BioCORBA spec 0.3 only. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Jason Stajich Email jason@bioperl.org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = Bio::Symbol::Symbol->new(); Function: Builds a new Bio::Symbol::Symbol object Returns : Bio::Symbol::Symbol Args : -name => descriptive name (string) [e.g. Met] -token => Shorthand token (string) [e.g. M] -symbols => Symbols that make up this symbol (array) [e.g. AUG] -matches => Alphabet in the event symbol is an ambiguity code. name Title : name Usage : my $name = $symbol->name(); Function: Get/Set Descriptive name for Symbol Returns : string Args : (optional) string token Title : token Usage : my $token = $self->token(); Function: Get/Set token for this symbol Example : Letter A,C,G,or T for a DNA alphabet Symbol Returns : string Args : (optional) string symbols Title : symbols Usage : my @symbols = $self->symbols(); Function: Get/Set Symbols this Symbol is composed from Example : Ambiguity symbols are made up > 1 base symbol Returns : Array of Bio::Symbol::SymbolI objects Args : (optional) Array of Bio::Symbol::SymbolI objects matches Title : matches Usage : my $matchalphabet = $symbol->matches(); Function: Get/Set (Sub) alphabet of symbols matched by this symbol including the symbol itself (i.e. if symbol is DNA ambiguity code W then the matches contains symbols for W and T) Returns : Bio::Symbol::AlphabetI Args : (optional) Bio::Symbol::AlphabetI equals Title : equals Usage : if( $symbol->equals($symbol2) ) { } Function: Tests if a symbol is equal to another Returns : Boolean Args : Bio::Symbol::SymbolI perl v5.14.2 2012-03-02 Bio::Symbol::Symbol(3pm)
All times are GMT -4. The time now is 09:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy