Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Extract paragraph that contains a value x<-30 Post 302970450 by Egy on Wednesday 6th of April 2016 04:36:47 PM
Old 04-06-2016
Extract paragraph that contains a value x<-30

I am using OSX. I have a multi-mol2 file (text file with coordinates and info for several molecules). An example of two molecules in the file is given below for molecule1 and molecule 2. The total file contains >50,000 molecules.

I would like to extract out and write to another file only the molecules that have a Grid Score < -30.0000. For the case below, it should only write for molecule1 (Grid Score = -43.6), but not molecule2 (Grid Score = -13.6).

Looking through the forum, I realized I need to do a paragraph grep or something analogous. The best I could determine is that I could use the awk command. But, I have no idea how to put in the condition for Grid Score < -30.

This is my first post, and I am very much an amateur. Any help to get me going in the right direction would be greatly appreciated. Forgive me if my post is not formatted correctly. Happy to take any criticism. Thanks.



Code:
########## Name:                molecule1
##########    Grid Score:          -43.616261
##########      Grid_vdw:          -38.348866
##########       Grid_es:           -5.267394
##########    Int_energy:            7.004528

@<TRIPOS>MOLECULE
molecule1
 50 50 1 0 0
SMALL
USER_CHARGES


@<TRIPOS>ATOM
      1 C1         23.3017   18.5209   24.1009 C.3     1  <0>        -0.1533
      2 C2         21.8869   18.3400   23.5472 C.3     1  <0>        -0.1225
      3 C3         21.8457   18.8065   22.0906 C.3     1  <0>        -0.1318
@<TRIPOS>BOND
     1     1     2    1
     2     1    21    1
@<TRIPOS>SUBSTRUCTURE
     1 <0>         1 TEMP              0 ****  ****    0 ROOT


########## Name:                molecule2
##########    Grid Score:          -13.616261
##########      Grid_vdw:          -18.348866
##########       Grid_es:           -1.267394
##########    Int_energy:            5.004528

@<TRIPOS>MOLECULE
molecule2
 50 50 1 0 0
SMALL
USER_CHARGES


@<TRIPOS>ATOM
      1 C1         23.3017   18.5209   24.1009 C.3     1  <0>        -0.1533
      2 C2         21.8869   18.3400   23.5472 C.3     1  <0>        -0.1225
      3 C3         21.8457   18.8065   22.0906 C.3     1  <0>        -0.1318
@<TRIPOS>BOND
     1     1     2    1
     2     1    21    1
@<TRIPOS>SUBSTRUCTURE
     1 <0>         1 TEMP              0 ****  ****    0 ROOT

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help, using awk to get paragraph

Hi, I'm trying to find pattern in log file. I'm using awk to search the pattern and print the paragraph. And it's not working well like I want. The file actually is TCAP message, it has format like this : ... ... ... ***************************************** INCOMING TCAP MESSAGE At... (6 Replies)
Discussion started by: kunimi
6 Replies

2. Linux

Extract a paragraph

Hi , Unix.com has been life saver for me I admit :) I am trying to extract a paragraph based on matching pattern "CREATE TABLE " from a ddl file . The paragraphs are seperated by blank line . Input file is #cat zip.20080604.sql1 CONNECT TO TST103 SET SESSION_USER OPSDM002 ... (2 Replies)
Discussion started by: capri_drm
2 Replies

3. UNIX for Dummies Questions & Answers

Split a paragraph

Hi, Consider the following paragraph. This is line1. This is line2, This is last line. I need the output as 4:This is last line. i.e The line after the blank line should be displayed along with line number. I am a unix begineer.Any one please help me to solve this problem (3 Replies)
Discussion started by: Sekar1
3 Replies

4. Shell Programming and Scripting

Pattern in a paragraph

Hi, I have read similar questions and I was not able to get a solution, so please help :) I have two files: 1-Pattern file contains list of patterns pattern1 pattern2 pattern3 pattern4 .... pattern# 2-input file in the format >hdhfshsdfjhpattern1xmbxmbxnmv... (4 Replies)
Discussion started by: tbakheet
4 Replies

5. UNIX for Dummies Questions & Answers

Output text from 1st paragraph in file w/ a specific string through last paragraph of file w/ string

Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string. Previously, I was outputting just each paragraph with that search string with: cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)
Discussion started by: carpenn
2 Replies

6. Shell Programming and Scripting

How to extract multiple line in a paragraph? Please help.

Hi all, The following lines are taken from a long paragraph: Labels of output orbitals: RY* RY* RY* RY* RY* RY* 1\1\GINC-COMPUTE-1-3\SP\UB3LYP\6-31G\C2H5Cr1O1(1+,5)\LIUZHEN\19-Jan-20 10\0\\# ub3lyp/6-31G pop=(nbo,savenbo) gfprint\\E101GECP\\1,5\O,0,-1.7 ... (1 Reply)
Discussion started by: liuzhencc
1 Replies

7. Shell Programming and Scripting

How to grep paragraph?

Hi, I have A file like this: >Contig1 AAAAAAATTTTTTCCCAATATATGAT ATATATAEATATATAT >Contig2 AAAAAAATTTTTTCCCAATATATGAT ATATATAEAATTTTTAATTTTTTCCCA ATCCCAAATATATAT >Contig3 AAAAAAATTTTTTCCCAATATATGAT ATATATAEAATTTTTAATTTTTTCCCA ATCCCAAATAAATTTTTTCCCAATAT ATGATATATATAEAATTTTTAATTTTT... (3 Replies)
Discussion started by: the_simpsons
3 Replies

8. Shell Programming and Scripting

Compare a paragraph

I know this is a challenging, its about comparing a 3 paragraph, from a whois command, i want to print what is the data that is not unique, example below is the admin phone and techphone, the rest is the same.it will print the correct and wrong # whois google.com| sed -n '/Registry Registrant... (3 Replies)
Discussion started by: kenshinhimura
3 Replies

9. Shell Programming and Scripting

How to extract a paragraph containing a given string?

Hello: Have a very annoying problem: Need to extract paragraphs with a specific string in them from a very large file with a repeating record separator. Example data: a file called test.out CREATE VIEW view1 AS something FROM table1 ,table2 as A, table3 (something FROM table4) FROM... (15 Replies)
Discussion started by: delphys
15 Replies

10. Shell Programming and Scripting

Bash script to extract paragraph with globs in it

Hi, Its been a long time since I have used Bash to write a script so am really struggling here. Need the gurus to help me out. uname -a Linux lxserv01 2.6.18-417.el5 i have a text file with blocks of code written in a similar manner ******* BEGIN MESSAGE ******* Station /... (12 Replies)
Discussion started by: dsid
12 Replies
obgrep(1)						      User's Reference Manual							 obgrep(1)

NAME
obgrep -- an advanced molecular search program using SMARTS SYNOPSIS
obgrep [OPTIONS] 'SMARTS-pattern' filename DESCRIPTION
The obgrep tool can be used to search for molecules inside multi-molecule database files (e.g., SMILES, SDF, etc.) or across multiple files. OPTIONS
If only a filename is given, obgrep will attempt to guess the file type from the filename extension. -c Print the number of matches -f Full match, print matching-molecules only when the number of heavy atoms is also equal to the number of atoms in the SMARTS pattern -i format Specifies input and output format, see babel(1) for available formats -n Only print the name of the molecules -t # Print a molecule only if the pattern occurs # times inside the molecule -v Invert the matching, print non-matching molecules EXAMPLES
Note that in all examples, the SMARTS pattern is enclosed in single quotes '...' to ensure it is not changed by the shell. Print all the molecules with a methylamine group: obgrep 'CN' database.smi Print all the molecules without a methylamine group: obgrep -v 'CN' database.smi Print the number of molecules without a methylamine group: obgrep -v -c 'CN' database.smi Print methylamine (if it exists in the file): obgrep -f 'CN' database.smi Print methylamine and/or methanol (if they exist): obgrep -f 'C[N,O]' database.smi Print all molecules with aromatic carbon in all SMILES files in the directory (i.e., *.smi) obgrep 'c' *.smi SEE ALSO
babel(1), obfit(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-2007 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 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy