Sponsored Content
Top Forums Shell Programming and Scripting awk to print line is values between two fields in separate file Post 302987693 by ronaldxs on Wednesday 14th of December 2016 10:46:37 AM
Old 12-14-2016
It looks to me like your program can be fixed with just small changes to one line. I get the same output as R. Singh

change
Code:
NR == FNR {min[$1]=$2; max[$1]=$3; Gene[$6]=$NF; next}

to
Code:
NR == FNR {min[NR]=$2; max[NR]=$3; Gene[NR]=$NF; next}

Now each record in the filter file has a separate entry in the min, max, and Gene arrays.
This User Gave Thanks to ronaldxs For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract nth line of all files and print in output file on separate lines.

Hello UNIX experts, I have 124 text files in a directory. I want to extract the 45678th line of all the files sequentialy by file names. The extracted lines should be printed in the output file on seperate lines. e.g. The input Files are one.txt, two.txt, three.txt, four.txt The cat of four... (1 Reply)
Discussion started by: yogeshkumkar
1 Replies

2. Shell Programming and Scripting

awk/sed script to print each line to a separate named file

I have a large 3479 line .csv file, the content of which looks likes this: 1;0;177;170;Guadeloupe;x 2;127;171;179;Antigua and Barbuda;x 3;170;144;2;Umpqua;x 4;170;126;162;Coos Bay;x ... 1205;46;2;244;Unmak Island;x 1206;47;2;248;Yunaska Island;x 1207;0;2;240;north sea;x... (5 Replies)
Discussion started by: kalelovil
5 Replies

3. Shell Programming and Scripting

awk print header as text from separate file with getline

I would like to print the output beginning with a header from a seperate file like this: awk 'BEGIN{FS="_";print ((getline < "header.txt")>0)} { if (! ($0 ~ /EL/ ) print }" input.txtWhat am i doing wrong? (4 Replies)
Discussion started by: sdf
4 Replies

4. Shell Programming and Scripting

awk: Print fields between two delimiters on separate lines and send to variables

I have email headers that look like the following. In the end I would like to accomplish sending each email address to its own variable, such as: user1@domain.com='user1@domain.com' user2@domain.com='user2@domain.com' user3@domain.com='user3@domain.com' etc... I know the sed to get rid of... (11 Replies)
Discussion started by: tay9000
11 Replies

5. UNIX for Dummies Questions & Answers

using sed delete a line from csv file based on specific data in two separate fields

Hello, :wall: I have a 12 column csv file. I wish to delete the entire line if column 7 = hello and column 12 = goodbye. I have tried everything that I can find in all of my ref books. I know this does not work /^*,*,*,*,*,*,"hello",*,*,*,*,"goodbye"/d Any ideas? Thanks Please... (2 Replies)
Discussion started by: Chris Eagleson
2 Replies

6. Programming

Read text from file and print each character in separate line

performing this code to read from file and print each character in separate line works well with ASCII encoded text void preprocess_file (FILE *fp) { int cc; for (;;) { cc = getc (fp); if (cc == EOF) break; printf ("%c\n", cc); } } int main(int... (1 Reply)
Discussion started by: khaled79
1 Replies

7. Shell Programming and Scripting

awk print even fields of file

Hello: I want to print out the even number of fields plus the first column as row identifiers. input.txt ID X1 ID X2 ID X3 ID X4 A 700 A 1200 A 400 A 1300 B 2000 B 1000 B 2000 B 600 C 1400 C 200 C 1000 C 1200 D 1300 D 500 D 600 D 200and the output is: output.txt ID X1 X2 X3... (3 Replies)
Discussion started by: yifangt
3 Replies

8. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies

9. Shell Programming and Scripting

awk to combine all matching fields in input but only print line with largest value in specific field

In the below I am trying to use awk to match all the $13 values in input, which is tab-delimited, that are in $1 of gene which is just a single column of text. However only the line with the greatest $9 value in input needs to be printed. So in the example below all the MECP2 and LTBP1... (0 Replies)
Discussion started by: cmccabe
0 Replies

10. Shell Programming and Scripting

Print line if values in fields matches number and text

datafile: 2017-03-24 10:26:22.098566|5|'No Route for Sndr:RETEK RMS 00040 /ZZ Appl:PF Func:PD Txn:832 Group Cntr:None ISA CntlNr:None Ver:003050 '|'2'|'PFI'|'-'|'EAI_ED_DeleteAll'|'EAI_ED'|NULL|NULL|NULL|139050594|ActivityLog| 2017-03-27 02:50:02.028706|5|'No Route for... (7 Replies)
Discussion started by: SkySmart
7 Replies
Bio::LiveSeq::Gene(3pm) 				User Contributed Perl Documentation				   Bio::LiveSeq::Gene(3pm)

NAME
Bio::LiveSeq::Gene - Range abstract class for LiveSeq SYNOPSIS
# documentation needed DESCRIPTION
This is used as storage for all object references concerning a particular gene. AUTHOR - Joseph A.L. Insana Email: Insana@ebi.ac.uk, jinsana@gmx.net APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : $gene = Bio::LiveSeq::Gene->new(-name => "name", -features => $hashref -upbound => $min -downbound => $max); Function: generates a new Bio::LiveSeq::Gene Returns : reference to a new object of class Gene Errorcode -1 Args : one string and one hashreference containing all features defined for the Gene and the references to the LiveSeq objects for those features. Two labels for defining boundaries of the gene. Usually the boundaries will reflect max span of transcript, exon... features, while the DNA sequence will be created with some flanking regions (e.g. with the EMBL_SRS::gene2liveseq routine). If these two labels are not given, they will default to the start and end of the DNA object. Note : the format of the hash has to be like DNA => reference to LiveSeq::DNA object Transcripts => reference to array of transcripts objrefs Transclations => reference to array of transcripts objrefs Exons => .... Introns => .... Prim_Transcripts => .... Repeat_Units => .... Repeat_Regions => .... Only DNA and Transcripts are mandatory verbose Title : verbose Usage : $self->verbose(0) Function: Sets verbose level for how ->warn behaves -1 = silent: no warning 0 = reduced: minimal warnings 1 = default: all warnings 2 = extended: all warnings + stack trace dump 3 = paranoid: a warning becomes a throw and the program dies Note: a quick way to set all LiveSeq objects at the same verbosity level is to change the DNA level object, since they all look to that one if their verbosity_level attribute is not set. But the method offers fine tuning possibility by changing the verbose level of each object in a different way. So for example, after $loader= and $gene= have been retrieved by a program, the command $gene->verbose(0); would set the default verbosity level to 0 for all objects. Returns : the current verbosity level Args : -1,0,1,2 or 3 perl v5.14.2 2012-03-02 Bio::LiveSeq::Gene(3pm)
All times are GMT -4. The time now is 01:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy