Sponsored Content
Top Forums Shell Programming and Scripting Match string from two files and print line Post 302997296 by zward on Wednesday 10th of May 2017 10:30:32 PM
Old 05-10-2017
Apologies, this is my first post. I thought it would be easier to explain with an ammended file but I've learnt this confuses things. My file 2 looks like this.

Code:
1       StringTie       exon    18887   19382   .       +       .       transcript_id "MSTRG.5.1"; gene_id "MSTRG.5"; exon_number "1";
1       StringTie       exon    189836  191490  .       +       .       transcript_id "MSTRG.5.1"; gene_id "MSTRG.5"; exon_number "2";
1       StringTie       exon    18887   19382   .       +       .       transcript_id "MSTRG.49.4"; gene_id "MSTRG.5"; exon_number "1";
1       StringTie       exon    189836  191490  .       +       .       transcript_id "MSTRG.49.4"; gene_id "MSTRG.5"; exon_number "2";

If I
Code:
 awk '{print$10} file2

this prints out the "MSTRG###"; string that I want to match to (I don't want to match the string from gene_id.

Last edited by Don Cragun; 05-10-2017 at 11:59 PM.. Reason: Add ICODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

exact string match ; search and print match

I am trying to match a pattern exactly in a shell script. I have tried two methods awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies

2. Shell Programming and Scripting

awk to print lines based on string match on another line and condition

Hi folks, I have a text file that I need to parse, and I cant figure it out. The source is a report breaking down softwares from various companies with some basic info about them (see source snippet below). Ultimately what I want is an excel sheet with only Adobe and Microsoft software name and... (5 Replies)
Discussion started by: rowie718
5 Replies

3. Shell Programming and Scripting

Print Line if next line Match a pattern

Hi All, Does anyone know how to print 1H1A....... in peal script print line ^1H1A....... if next line equal 5R0RECEIPT.... Thank for help:D Cat st.txt 1H1A-IN-11-5410-0009420|1010047766|dsds|1|N|IN|IN|000000|1||N|<<<line match 5R0RECEIPT| 5R0RECEIPT|... (2 Replies)
Discussion started by: kittiwas
2 Replies

4. Shell Programming and Scripting

How to print everything after a string match

Hi all, I'm trying to do some work on the authorized_keys file to do a check if there's any information after the hash key.. At the end of the hash key's in the file, there can be an = or == Is there a way to check if anything exists after these equals and if so print it out or else print... (2 Replies)
Discussion started by: Jazmania
2 Replies

5. Shell Programming and Scripting

Print lines that match regex on xth string

Hello, I need an awk command to print only the lines that match regex on xth field from file. For example if I use this command awk -F"|" ' $22 == "20130117090000.*" 'It wont work, I think, because single quotes wont allow the usage of the metacharacter star * . On the other hand I dont know... (2 Replies)
Discussion started by: black_fender
2 Replies

6. Shell Programming and Scripting

Print string after the word match

Hi, I have the logs : cat logsx.txt 744906,{"reportingGroups":,"version":"2.0"} 678874,{"reportingGroups":,"version":"2.0"} 193571,{"reportingGroups":,"version":"2.0"} 811537,{"reportingGroups":,"version":"2.0"} 772024,{"reportingGroups":,"version":"2.0"}... (5 Replies)
Discussion started by: justbow
5 Replies

7. Shell Programming and Scripting

Need to print the next word from the same line based on grep string condtion match.

I need to fetch particular string from log file based on grep condition match. Actual requirement is need to print the next word from the same line based on grep string condtion match. File :Java.lanag.xyz......File copied completed : abc.txt Ouput :abc.txt I have used below... (5 Replies)
Discussion started by: siva83
5 Replies

8. Shell Programming and Scripting

Grep command to search a regular expression in a line an only print the string after the match

Hello, one step in a shell script i am writing, involves Grep command to search a regular expression in a line an only print the string after the match an example line is below /logs/GRAS/LGT/applogs/lgt-2016-08-24/2016-08-24.8.log.zip:2016-08-24 19:12:48,602 ERROR... (9 Replies)
Discussion started by: Ramneekgupta91
9 Replies

9. Shell Programming and Scripting

Print next line beside preceding line on column match

Hi, I have some data like below: John 254 Chris 254 Matt 123 Abe 123 Raj 487 Moh 487 How can i print it using awk to have: 254 John,Chris 123 Matt,Abe 487 Raj,Moh Thanks. (4 Replies)
Discussion started by: james2009
4 Replies

10. UNIX for Beginners Questions & Answers

awk script to match string and print status

Dear team, Need support to built awk script for below requirement Input file LOTC cluster state: ------------------- Node safNode=SC_2_1 joined cluster | Node safNode=SC_2_2 joined cluster | Node safNode=PL_2_3 fail cluster | AMF cluster state: ------------------... (16 Replies)
Discussion started by: shanul karim
16 Replies
BP_UNFLATTEN_SEQ(1p)					User Contributed Perl Documentation				      BP_UNFLATTEN_SEQ(1p)

NAME
unflatten_seq - unflatten a genbank or genbank-style feature file into a nested SeqFeature hierarchy SYNOPSIS
unflatten_seq.PLS -e 3 -gff ~/cvs/bioperl-live/t/data/AE003644_Adh-genomic.gb unflatten_seq.PLS --detail ~/cvs/bioperl-live/t/data/AE003644_Adh-genomic.gb unflatten_seq.PLS -i foo.embl --from embl --to chadoxml -o out.chado.xml unflatten_seq.PLS --notypemap --detail --to asciitree -ethresh 2 AE003644_Adh-genomic.gb DESCRIPTION
This script will unflatten a genbank or genbank-style file of SeqFeatures into a nested hierarchy. See Bio::SeqFeature::Tools::Unflattener In a GenBank/EMBL representation, features are 'flat' - for example, there is no link between an mRNA and a CDS, other than implicit links (eg via tags or via splice site coordinates) which may be hard to code for. This is most easily illustrated with the default output format, asciitree An unflattened genbank feature set may look like this (AB077698) Seq: AB077698 databank_entry 1..2701[+] gene mRNA CDS hCHCR-G 80..1144[+] exon 80..1144[+] five_prime_UTR 1..79[+] located_sequence_feature 137..196[+] located_sequence_feature 239..292[+] located_sequence_feature 617..676[+] located_sequence_feature 725..778[+] three_prime_UTR 1145..2659[+] polyA_site 1606..1606[+] polyA_site 2660..2660[+] Or like this (portion of AE003734) gene mRNA CG3320-RA CDS CG3320-PA 53126..54971[-] exon 52204..53323[-] exon 53404..53631[-] exon 53688..53735[-] exon 53798..53918[-] exon 54949..55287[-] mRNA CG3320-RB CDS CG3320-PB 53383..54971[-] exon 52204..53631[-] exon 53688..53735[-] exon 53798..53918[-] exon 54949..55287[-] The unflattening will also 'normalize' the containment hierarchy (in the sense of standardising it - e.g. making sure there is always a transcript record, even if genbank just specifies CDS and gene) By default, the GenBank types will be mapped to SO types See Bio::SeqFeature::Tools::TypeMapper COMMAND LINE ARGUMENTS
-i|input FILE input file (can also be specified as last argument) -from FORMAT input format (defaults to genbank) probably doesnt make so much sense to use this for non-flat formats; ie other than embl/genbank -to FORMAT output format (defaults to asciitree) should really be a format that is nested SeqFeature aware; I think this is only asciitree, chadoxml and gff3 -gff with export to GFF3 format (pre-3 GFFs make no sense with unflattened sequences, as they have no set way of representing feature graphs) -o|output FILE outfile defaults to STDOUT -detail show extra detail on features (asciitree mode only) -e|ethresh INT sets the error threshold on unflattening by default this script will throw a wobbly if it encounters weird stuff in the genbank file - raise the error threshold to signal these to be ignored (and reported on STDERR) -nomagic suppress use_magic in unflattening (see Bio::SeqFeature::Tools::Unflattener -notypemap suppress type mapping (see Bio::SeqFeature::Tools::TypeMapper TODO
Bio::SeqFeature::Tools::Unflattener allows fine-grained control over the unflattening process - need to add more options to allow this control at the command line 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 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 email or the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR
Chris Mungall E<lt>cjm-at-bioperl.orgE<gt> perl v5.14.2 2012-03-02 BP_UNFLATTEN_SEQ(1p)
All times are GMT -4. The time now is 10:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy