Sponsored Content
Full Discussion: Insert id from same block
Top Forums Shell Programming and Scripting Insert id from same block Post 302902113 by Don Cragun on Sunday 18th of May 2014 06:15:42 PM
Old 05-18-2014
The following seems to do what you want:
Code:
awk '
$3 == "gene" || $3 == "protein_coding_gene" {
	end = index($NF, ";")
	id = ";gene_id=" substr($NF, 4, end - 4)
}
$3 == "exon" {
	$0 = $0 id
}
1' file

If you want to run this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Complex Insert block in the Script

I have script in that there are thousands of create statement... I want to add these lines, above every Create Stament ================================================ IF OBJECT_ID('dbo.account_account_relations') IS NOT NULL BEGIN DROP TABLE dbo.account_account_relations IF... (2 Replies)
Discussion started by: niceboykunal123
2 Replies

2. Shell Programming and Scripting

how to append a block of statements after another block in the file

Hi I need to append the following block of statements in the middle of the file: # openpipe tsdbdwn2 set -x exec >> /tmp/tsdbdwn2.fifo 2>&1 # This needs to be appended right after another block of statements: if test $# -eq 0 ;then echo "Safety check - do you really wish to run" $0 "... (5 Replies)
Discussion started by: aoussenko
5 Replies

3. Shell Programming and Scripting

block of name value pair to db insert statements

Hi, I need to convert the following file into DB insert statements. $ cat input.txt START name=john id=123 date=12/1/09 END START name=sam id=4234 status=resigned date=12/1/08 END (2 Replies)
Discussion started by: vlinet
2 Replies

4. Shell Programming and Scripting

Insert Block of Text into a File After a Ranged Search

Hello, I've been racking my brain trying to find a good way to accomplish a task. I need to insert a block of text into a file in the format of FirewallRuleSet proxy-users { FirewallRule allow to 0.0.0.0/0 } I need to insert this block of text (which could have sed special... (2 Replies)
Discussion started by: 0xception
2 Replies

5. Shell Programming and Scripting

How to insert text after a block of text?

Input: fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The file is located under /etc, so the full path to this file is /etc/fstab. The >>>>> characters would be replaced by some texts. For example if i run a... (5 Replies)
Discussion started by: cola
5 Replies

6. UNIX for Advanced & Expert Users

Deciding whether to get a buffer cache block or inode block

I was reading a book on UNIX internals "The design of the UNIX Operating system." There are two memory structures that are confusing me: 1) Buffer cache 2) Inode cache My questions are 1) Does a process get both buffer cache and Indoe cache allocated when it opens/creates a file? 2) if no,... (1 Reply)
Discussion started by: sreeharshasn
1 Replies

7. Shell Programming and Scripting

Grepping text block by block by using for loop

Hei buddies, Need ur help once again. I have a file which has bunch of lines which starts from a fixed pattern and ends with another fixed pattern. I want to make use of these fixed starting and ending patterns to select the bunch, one at a time. The input file is as follows. Hi welcome... (12 Replies)
Discussion started by: anushree.a
12 Replies

8. UNIX for Advanced & Expert Users

Move a block of lines to file if string found in the block.

I have a "main" file which has blocks of data for each user defined by tags BEGIN and END. BEGIN ID_NUM:24879 USER:abc123 HOW:47M CMD1:xyz1 CMD2:arp2 STATE:active PROCESS:id60 END BEGIN ID_NUM:24880 USER:def123 HOW:4M CMD1:xyz1 CMD2:xyz2 STATE:running PROCESS:id64 END (7 Replies)
Discussion started by: grep_me
7 Replies

9. Shell Programming and Scripting

Printing a block of lines from a file, if that block does not contain two patterns using sed

I want to process a file block by block using sed, and if that block does not contain two patterns, then that complete block has to be printed. See below for the example data. ................................server 1............................... running process 1 running... (8 Replies)
Discussion started by: Kesavan
8 Replies

10. UNIX for Dummies Questions & Answers

Add a block of code at the end of a specific block

I need to search for a block with the starting pattern say "tabId": "table_1", and ending pattern say "]" and then add a few lines before "]" "block1":"block_111" "tabId": "table_1", "title":"My title" ..... .... }] how do I achieve it using awk and sed. Thanks, Lakshmi (3 Replies)
Discussion started by: Lakshmikumari
3 Replies
Bio::PrimerDesigner::Tables(3pm)			User Contributed Perl Documentation			  Bio::PrimerDesigner::Tables(3pm)

NAME
Bio::PrimerDesigner::Table -- Draw HTML tables for PCR primer display DESCRIPTION
Draws simple HTML tables to display Bio::PrimerDesigner PCR primer design and e-PCR results for web applications. METHODS
info_table Prints a two-column table for generic, key-value style annotations. Expects to be passed the name of the gene/feature/etc. and a hash of attributes. If there is an 'image' key, the value is assumed to be an image URL, which is printed in a double-wide cell at the bottom of the table. my $gene = 'Abc-1'; my %gene_info = ( Chromosome => I, Start => 100450, Stop => 102893, Strand => '+' ); my $page = Bio::PrimerDesigner::Tables->new; $page->info_table( $gene, %gene_info ); PCR_header Returns a generic header for the PCR primer table. Does not expect any argumments. PCR_set Returns the top row for the PCR primer table. Expects the primer set number as its only argument. PCR_row Returns table rows with PCR primer info. Should be called once for each primer pair. Expects to be passed a hash containing the Bio::PrimerDesigner::Result object and the primer set number and an (optional) label. my $pcr_row = PCR_row( primers => $result_obj, setnum => $set_number, label => $label ); ePCR_row Returns table rows summarizing e-PCR results. Expects to be passed an Bio::PrimerDesigner::Result e-PCR results object and an optional e-PCR label. render Renders the image URL. Expects to be passed a hash of the map start and stop, and other features to be mapped (i.e. gene,forward_primer,reverse_primer, label,start and stop of each feature, and gene strand). my $image = $page->render( start => $startleft, stop => $startright, feat => $features ); PCR_map Returns a 6 column wide table cell with the <IMG ...> info. Will display the image of mapped primers in the browser when passed the image URL. AUTHOR
Copyright (C) 2003-2009 Sheldon McKay <mckays@cshl.edu>. LICENSE
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 3 or 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; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. SEE ALSO
Bio::PrimerDesigner::primer3, Bio::PrimerDesigner::epcr. perl v5.10.0 2009-08-04 Bio::PrimerDesigner::Tables(3pm)
All times are GMT -4. The time now is 11:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy