Sponsored Content
Top Forums Shell Programming and Scripting awk-filter record by another file Post 302658899 by drl on Wednesday 20th of June 2012 06:50:48 AM
Old 06-20-2012
Hi.

I agree with sdf, the extra 2 lines appear. The alternate statements:
Code:
if($0 >= i+0 && $0 <= a[i]) # SUCCEEDS!
if($0 >= int(i) && $0 <= a[i]) # SUCCEEDS!

will both work. Of the two, I think the i+0 is a bit tricky, especially for people who don't know awk well, so I would choose int(i) and add a comment why it is required. Or perhaps add the int() to all 4 as elixir_sinari wrote and omit any confusing explanation. Good point about floats, however. I suppose one
could precondition all the data to truncate to integers, especially in this case ... cheers, drl

Last edited by drl; 06-20-2012 at 07:56 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

filter the uniq record problem

Anyone can help for filter the uniq record for below example? Thank you very much Input file 20090503011111|test|abc 20090503011112|tet1|abc|def 20090503011112|test1|bcd|def 20090503011131|abc|abc 20090503011131|bbc|bcd 20090503011152|bcd|abc 20090503011151|abc|abc... (8 Replies)
Discussion started by: bleach8578
8 Replies

2. Shell Programming and Scripting

Help in writing a KSH script to filter the latest record?

Hi All, I have a text file with the folowing content. BANGALORE|1417|2010-02-04 08:41:04.174|dob|xxx BANGALORE|1416|2010-02-04 08:23:19.566|dob|yyy BANGALORE|1415|2010-02-04 08:20:14.497|dob|aaa BANGALORE|1414|2010-02-04 08:19:40.065|dob|vvv BANGALORE|1413|2010-02-04... (4 Replies)
Discussion started by: Karpak
4 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

filter record from a file reading another file

Hi, I want to filter record from a file if the records in the second column matches the data in another file. I tried the below awk command but it filters the records in the filter file. I want the opposite, to include only the records in the filter file. I tried this: awk -F'|'... (8 Replies)
Discussion started by: gpaulose
8 Replies

5. Shell Programming and Scripting

Filter record from a file

Reposting since I didnt not get any reply. I have a problem while filtering records from a file. Can somebody help please? For eg: Consider the below files Record file: 0003@00000000000190@20100401@201004012010040120100401@003@... (1 Reply)
Discussion started by: gpaulose
1 Replies

6. Shell Programming and Scripting

AWK filter from file and print

Dear all, I am using awk to filter some data like this:- awk 'NR==FNR{a;next}($1 in a)' FS=":" filter.dat data.dat >! out.dat where the filter and input data look like this:- filter.dat... n_o00j_1900_40_007195350_0:n_o00j_1940_40_007308526... (3 Replies)
Discussion started by: atb299
3 Replies

7. Shell Programming and Scripting

Help with awk, using a file to filter another one

I have a main file: ... 17,466971 0,095185 17,562156 id 676 17,466971 0,096694 17,563665 id 677 17,466971 0,09816 17,565131 id 678 17,466971 0,099625 17,566596 id 679 17,466971 0,101091 17,568062 id 680 17,466971 0,016175 17,483146 id... (4 Replies)
Discussion started by: boblix
4 Replies

8. Shell Programming and Scripting

Delete record filter by column

Dear friend, I have a file 2 files with column wise FILE_A ------------------------------ x,1,@ y,3,$ x,5,% FILE_B -------------------- x,1,@ i like to delete the all lines in FILE_A ,if first column available in FILE_B. output (in FILE_A) y,3,$ x,5,% (10 Replies)
Discussion started by: Jewel
10 Replies

9. Shell Programming and Scripting

Filter and sort the file using awk

I have file and process it and provide clean output. input file Device Symmetrix Name : 000A4 Device Symmetrix Name : 000A5 Device Symmetrix Name : 000A6 Device Symmetrix Name : 000A7 Device Symmetrix Name : 000A8 Device Symmetrix Name : 000A9 Device Symmetrix Name ... (10 Replies)
Discussion started by: ranjancom2000
10 Replies

10. 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
obrotate(1)						      User's Reference Manual						       obrotate(1)

NAME
obrotate -- batch-rotate dihedral angles matching SMARTS patterns SYNOPSIS
obrotate 'SMARTS-pattern' filename atom1 atom2 atom3 atom4 angle DESCRIPTION
The obrotate program rotates the torsional (dihedral) angle of a specified bond in molecules to that defined by the user. In other words, it does the same as a user setting an angle in a molecular modelling package, but much faster and in batch mode (i.e. across multiple molecules in a file). The four atom IDs required are indexes into the SMARTS pattern, which starts at atom 0 (zero). The angle supplied is in degrees. The two atoms used to set the dihedral angle <atom1> and <atom4> do not need to be connected to the atoms of the bond <atom2> and <atom3> in any way. The order of the atoms matters -- the portion of the molecule attached to <atom1> and <atom2> remain fixed, but the portion bonded to <atom3> and & <atom4> moves. EXAMPLES
Let's say that you want to define the conformation of a large number of molecules with a pyridyl scaffold and substituted with an aliphatic chain at the 3-position, for example for docking or 3D-QSAR purposes. To set the value of the first dihedral angle to 90 degrees: obrotate 'c1ccncc1CCC' pyridines.sdf 5 6 7 8 90 Here 6 and 7 define the bond to rotate in the SMARTS patter, i.e., c1-C and atoms 5 and 8 define the particular dihedral angle to rotate. Since the atoms to define the dihedral do not need to be directly connected, the nitrogen in the pyridine can be used: obrotate 'c1ccncc1CCC' pyridines.sdf 4 6 7 8 90 Keep the pyridyl ring fixed and moves the aliphatic chain: obrotate 'c1ccncc1CCC' pyridines.sdf 5 6 7 8 90 Keep the aliphatic chain fixed and move the pyridyl ring: obrotate 'c1ccncc1CCC' pyridines.sdf 8 7 6 5 90 SEE ALSO
babel(1), obchiral(1), obfit(1), obgrep(1), obprop(1), obrotate(1). The web pages for Open Babel can be found at: <http://openbabel.org/> A guide for constructing SMARTS patterns can be found at: <http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html> AUTHORS
The obgrep program was contributed by Fabien Fontaine Open Babel is developed by a cast of many, including currrent maintainers Geoff Hutchison, Chris Morley, Michael Banck, and innumerable oth- ers who have contributed fixes and additions. For more contributors to Open Babel, see <http://openbabel.org/wiki/THANKS> COPYRIGHT
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc. Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison and other contributors. This program 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 version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL- ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Open Babel 2.2 July 4, 2008 Open Babel 2.2
All times are GMT -4. The time now is 01:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy