10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
In the awk I am splitting on the : into array a, then splitting on the - into element b. I can not seem to duplicate b if there is no - after it. Lines 1,2,4 are examples. If there is a - after the number in b then the value to the right of it is $3 in the ouput. Thank you :).
awk... (2 Replies)
Discussion started by: cmccabe
2 Replies
2. Shell Programming and Scripting
In the tab-delimited input below I am trying to use awk to -10 from $2 and +10 to $3. Something like
awk -F'\t' -v OFS='\t' -v s=10 '{split($4,a,":"); print $1,$2-s,$3+s,a,$5,$6} | awk {split(a,b,"-"); print $1,$2-s,$3+s,b-s,b+s,$5,$6}' input
should do that. I also need to -10 from $4... (2 Replies)
Discussion started by: cmccabe
2 Replies
3. Shell Programming and Scripting
I am trying to split a tab-delimeted file using awk after the second _ in bold. The awk below is close but splits on the first _, and I am not sure how to use the second _. Thank you :).
file
chr1 92145889 92149424 NM_001195684_exon_0_10_chr1_92145900_r 0 -
chr1 92161218 ... (4 Replies)
Discussion started by: cmccabe
4 Replies
4. Shell Programming and Scripting
Hi All,
A very silly question:
How to just print the integer attached a particular string in a line by awk?
Ex:
Happy_world_foo123...So i just want the value 123 to be printed on the line where we have string "foo".
Thanks (16 Replies)
Discussion started by: Indra2011
16 Replies
5. Shell Programming and Scripting
Hello;
I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Discussion started by: yifangt
5 Replies
6. Shell Programming and Scripting
Hi there I have a text file with several fields separated by ";" as follow :
5466-43;5466;JOAN;LIGA;LIGA ESPANOLA;43;DEP LA CORUNA - OSASUNA;10/01/10 17:00
5466-44;5466;CARLES;LIGA;LIGA ESPANOLA;44;MALAGA - ATHL BILBAO;10/01/10 17:00
5466-45;5466;FAB;LIGA;LIGA ESPANOLA;45;REAL MADRID -... (4 Replies)
Discussion started by: capnino
4 Replies
7. Shell Programming and Scripting
Hi Experts,
I have a Input.txt document which contains data fields seperated by tabs. There are 4 fields totally Named UNIQUE, ORDER, CONTACT and WINS. The UNIQUE field contains unique ID and the CONTACT field contains data seperated by comma in some records. I am looking to write an awk script... (12 Replies)
Discussion started by: forumthreads
12 Replies
8. UNIX for Dummies Questions & Answers
Hi ,
I have a simple question in awk, i have long string which i am getting for a grep command. the output contains 50 fields.
I need to display like first 5 fileds in a line and rest of all fields in the next line.
{ for(i=5;i<NF;++i) s= $i; print $1,$2,$3,$4,$5,"\n",$s}
Is the above... (1 Reply)
Discussion started by: senthilkumar_ak
1 Replies
9. Shell Programming and Scripting
I am trying to pull data out of a file to execute a series of repetitive commands. One of the fields is a {hex number}.{hex number} pattern. I need the first part of that structure to pass into the command. The file structure is like this:
A 2007/10/20 09:50:00 li text ef6da.1 name ... (6 Replies)
Discussion started by: oly_r
6 Replies
10. Shell Programming and Scripting
Hi all,
I have a field in the line, let's say argument $6, which is in the format 00.00
If i want to split the field to get rid of the "." in between of the amount, how can i do that i awk script?
I have it like this
split($6,a,".")
but it will get rid of the last 2 digits after the... (4 Replies)
Discussion started by: CamTu
4 Replies