Reverse script usage -Awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reverse script usage -Awk
# 1  
Old 01-24-2011
Reverse script usage -Awk

Is it possible to convert EXONtoBED (Output to input)?

1. BEDtoExon.sh
-------------------
Code:
awk '{
  n11 = split($11, t11, ",")
  n12 = split($12, t12, ",")
  for (i = 0; ++i < n11;) {
	s12 = $2 + t12[i]
    print $1, s12, s12 + t11[i], i”E_”$4
	}
  }' $1

----------------------------------------------------------------------------------------------------------------------------
$ sh BedtoExon.sh input >>ExonDB

input (BED Format)
Code:
chr1	87942437    	87952030    	NM_001144992	0   	+   	87942537	87949664    	0   	3   	710,114,2506,   0,2725,7087,
chr1	89967353    	90116577    	NM_201644   	0   	+   	89967404	90114999    	0   	5   	900,132,88,220,1876,	0,144265,145016,145359,147348,

output (EXON Format)
Code:
chr1 	87942437 	87943147 	1E_NM_001144992
chr1 	87945162 	87945276 	2E_NM_001144992
chr1 	87949524 	87952030 	3E_NM_001144992
chr1 	89967353 	89968253 	1E_NM_201644
chr1 	90111618	 90111750 	2E_NM_201644
chr1 	90112369 	90112457 	3E_NM_201644
chr1	 90112712 	90112932 	4E_NM_201644
chr1 	90114701 	90116577 	5E_NM_201644

# 2  
Old 01-24-2011
it's hard, because only from the output, we can't guess the data from $3 ~ $10 (except $4) in input file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk reverse string

Hello, Can anyone explain for me in this script to reverse the string? 1) the "x=x" part, how it works? $ echo welcome | awk '{ for(i=length;i!=0;i--)x=x substr($0,i,1);}END{print x}' $ emoclew2) x seems to be an array at the END, but can it automatically print the whole array in awk? Thanks... (8 Replies)
Discussion started by: yifangt
8 Replies

2. Shell Programming and Scripting

Passing --usage as argument to awk script

I have the awk script below and things go wrong when I do awk -v dsrmx=25 -f ./checkSRDry.awk --usage I basically want to override the usual --usage and --help that awk gives. How do people usually handle this situation when you also want to supply your own usage and help concerning the... (2 Replies)
Discussion started by: kristinu
2 Replies

3. Shell Programming and Scripting

usage of AWK command under perl script

i have two files as shown below t1.txt: argument1 argu2 argu37 t2.txt: 22 33 44 i want o/p as argument1 22 argu2 33 argu37 44 i am trying to merge two file under perl script using following system("paste t1.txt t2.txt | awk... (3 Replies)
Discussion started by: roopa
3 Replies

4. Shell Programming and Scripting

Cut or awk in reverse

I may be making this too hard on myself, but I'm trying to find a way that I can use a cut or awk string to always remove the last two delimited fields of a string. Say I have PackageName-U939393-8.2.3.4.s390x.rpm But the s390x could be any string w/o periods in it, x8664 for example,... (9 Replies)
Discussion started by: cbo0485
9 Replies

5. Shell Programming and Scripting

Help with sed/awk for reverse search and print

I have a file which is DFDG START DSFDS DSDS XXX END (VIO) AADD START SDSD FGFG END and I have to print the lines between START and END (VIO). In the files there are multiple places where START would be followed by END with few lines in between but I need to print only if START is... (18 Replies)
Discussion started by: pgbuddy
18 Replies

6. Shell Programming and Scripting

Script to take a word and reverse it

Hi, I am looking for some help and this is my first post so hopefully I will get this right. I have been asked to write a script which when run asks the user to input a word. once they have inputed there choosen word (This can be anything) I need to echo to screen there choosen word in reverse.... (10 Replies)
Discussion started by: charlie101208
10 Replies

7. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

8. Shell Programming and Scripting

awk, shell script reverse engineering app generator - project

Hi, this is fantastic forum for shell programming and scripting, so please let me to introduce you with my very old concept to have web form/s with radio, select, input fields and have an application generating valid, syntax error free scripting code. The same or alike questions are asked... (2 Replies)
Discussion started by: darius2
2 Replies

9. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

10. Shell Programming and Scripting

reverse search in awk script

Hi, I am new to awk. Actually I want to search a pattern A, when I get that line with pattern A then for one of the field of that line again I want search on that field (say pattern B)from start of the file. I am using awk. Is nested searching possible in awk? Please do the needful as... (4 Replies)
Discussion started by: id4forum
4 Replies
Login or Register to Ask a Question