Unix/Linux Go Back    

Showing results 1 to 25 of 500
Search took 0.08 seconds.
Search: Posts Made By: cmccabe
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 3
Views: 254
Posted By Don Cragun
The following seems to do what I think you want;...

The following seems to do what I think you want; which assumes you don't want extra whitespace characters added to the ends of your output lines, that you want <tab> delimited output from your <tab>...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 3
Views: 254
Posted By Chubler_XL
Try this: awk -F'\t' ' /^aa/{ ...

Try this:

awk -F'\t' '
/^aa/{ # if line starts with aa
if(f) close(f) # close already open file
f=sprintf($1"%d.txt",++n) # pre...
Forum: Shell Programming and Scripting Linux 04-17-2018
Replies: 2
Views: 130
Posted By vgersh99
BEGIN { FS=OFS="\t" suf="_exon" } { ...

BEGIN {
FS=OFS="\t"
suf="_exon"
}
{
sf=""
len1=split($10,s1,",")
split($11,s2,",")
for (i=1;i<len1;i++)
sf=sf $3 ":" s1[i] "-" s2[i] suf (($4=="+")?i:len1-i) ","
Forum: Shell Programming and Scripting Linux 03-25-2018
Replies: 2
Views: 235
Posted By Chubler_XL
Few things here. 1. Process file2 first so...

Few things here.

1. Process file2 first so you can have a[$5,$6,$9] populated when processing files2
2. Why store x[NR] when you are only interested in x[2] I replaced with FNR==2 {x=$5} to only...
Forum: Shell Programming and Scripting Linux 02-19-2018
Replies: 2
Views: 319
Posted By rdrtx1
awk ' BEGIN {FS = OFS = "\t"} # define FS and...

awk '
BEGIN {FS = OFS = "\t"} # define FS and OFS as tab
FNR==NR{ # process same line
split($4,array,"_"); # split $4 on _ and srore in array
b[FNR]=$3-$2;...
Forum: Shell Programming and Scripting Linux 02-20-2018
Replies: 2
Views: 308
Posted By Chubler_XL
Few issues with your code: 1. P[] is not...

Few issues with your code:

1. P[] is not assigned.
2. Poorly formatted line with comment between condition and { action }
3. T[] referenced without an index
4. P[] referenced with wrong field...
Forum: Shell Programming and Scripting Linux 02-15-2018
Replies: 6
Views: 338
Posted By vgersh99
if($1 in A)... print "overlap", $7; else print...

if($1 in A)...
print "overlap", $7; else print "missing", $7you'll also need to work out your balancing ()-s in the if and other potential syntax errors.
Forum: Shell Programming and Scripting Linux 02-15-2018
Replies: 6
Views: 338
Posted By vgersh99
okie dokie - interesting "construct" [A] - see my...

okie dokie - interesting "construct" [A] - see my previous comments.
you probably meant: ($1 in A) as $1 and array[5] are the same in file2.

$7 = print "overlap" else "missing"
what is that...
Forum: Shell Programming and Scripting Linux 02-15-2018
Replies: 6
Views: 338
Posted By vgersh99
if([A] ~ array)what is [A]? And what the above...

if([A] ~ array)what is [A]?
And what the above is trying to test?

FYI, split

split(s, a [, r ])
Split the string s into the array a
...
Forum: Shell Programming and Scripting Linux 01-27-2018
Replies: 3
Views: 368
Posted By Don Cragun
In addition to what rdrtx1 already suggested, we...

In addition to what rdrtx1 already suggested, we could try something a little closer to what you were doing with sub():
awk 'BEGIN {OFS=FS="\t"} {sub(/^\.$/,$6,$8); print}' file
but this will only...
Forum: Shell Programming and Scripting Linux 01-27-2018
Replies: 3
Views: 368
Posted By rdrtx1
awk 'BEGIN {OFS=FS="\t"} {if ($8==".") $8=$6;...

awk 'BEGIN {OFS=FS="\t"} {if ($8==".") $8=$6; print }' file
Forum: Shell Programming and Scripting Linux 01-23-2018
Replies: 4
Views: 362
Posted By rdrtx1
awk ' BEGIN { FS=OFS="\t" } $9 ~ /NM/ { ...

awk '
BEGIN { FS=OFS="\t" }
$9 ~ /NM/ {
gsub(";", ":p=?;", $9);
sub("$", ":p=?", $9);
} 1' file
Forum: Shell Programming and Scripting Linux 01-23-2018
Replies: 4
Views: 362
Posted By Don Cragun
Hi cmccabe, I agree with rdrtx1 that the code...

Hi cmccabe,
I agree with rdrtx1 that the code suggested in post #2 should do what you want.

What I don't understand is how the code you showed us in post #1 could produce the output that you...
Forum: Shell Programming and Scripting Linux 01-09-2018
Replies: 5
Views: 387
Posted By Don Cragun
Yes, the code you have shown us is easy to...

Yes, the code you have shown us is easy to understand. And, with or without sample input files, we can easily say that most of the output you have shown did not come from the code you have shown us....
Forum: Shell Programming and Scripting Linux 01-09-2018
Replies: 5
Views: 387
Posted By Don Cragun
The output you have shown us might have come from...

The output you have shown us might have come from the code you have shown us as an output based on input files you have not shown us or it might be totally unrelated to the code you have shown us. ...
Forum: Shell Programming and Scripting Linux 01-08-2018
Replies: 4
Views: 380
Posted By MadeInGermany
You do not need to store the key here; saves some...

You do not need to store the key here; saves some memory:
awk '
NR==FNR { a[$1]; next }
$2=="CNV" {
c=split($3, b, "[,:]")
if (b[2]>=4.0 || (b[2]<=1.0 && b[c]<=1.9 && ($NF in a))) print
}...
Forum: Shell Programming and Scripting Linux 01-04-2018
Replies: 4
Views: 380
Posted By rdrtx1
awk ' NR==FNR {a[$1]=$1; next;} $2=="CNV" { ...

awk '
NR==FNR {a[$1]=$1; next;}
$2=="CNV" {
c=split($3, b, "[,:]");
if (b[2]>=4.0 || (b[2]<=1.0 && b[c]<=1.9 && length(a[$NF]))) print $0;
}
' list FS="\t" infile
Forum: Shell Programming and Scripting Linux 01-03-2018
Replies: 3
Views: 287
Posted By MadeInGermany
You do not need to store any values in the array....

You do not need to store any values in the array.
The lookup of the array index is done with in like this
awk 'NR==FNR{c[$1]; next} ($1":"$2) in c' file1 FS="\t" file2
Forum: Shell Programming and Scripting Linux 01-03-2018
Replies: 3
Views: 287
Posted By rdrtx1
awk 'NR==FNR{c[$1]=$1;next} c[$1":"$2]' file1...

awk 'NR==FNR{c[$1]=$1;next} c[$1":"$2]' file1 FS="\t" file2
Forum: UNIX for Beginners Questions & Answers Linux 12-14-2017
Replies: 4
Views: 187
Posted By jim mcnamara
Pick another user, go into crontab as that user. ...

Pick another user, go into crontab as that user. Create a new entry for the job. The user should be one with suitable permissions to run other code later on against the downloaded file. Hopefully...
Forum: Shell Programming and Scripting Linux 11-29-2017
Replies: 6
Views: 411
Posted By Don Cragun
Assuming that your sample data is representative,...

Assuming that your sample data is representative, the following seems to do what you want:
awk '
BEGIN { FS = OFS = "\t"
}
NF == 10 {
split($8, a, /[=;]/)
$11 = $12 = $13 = $14 = $15 = $18 =...
Forum: Shell Programming and Scripting Linux 11-29-2017
Replies: 6
Views: 411
Posted By Don Cragun
I'm very confused. Are you just trying to...

I'm very confused.

Are you just trying to print lines that need to have fields added? Or, do you want to print all lines in the file whether they change or not? Your code makes no attempt to...
Forum: Shell Programming and Scripting Linux 11-29-2017
Replies: 6
Views: 411
Posted By Don Cragun
Other than adding text to the end of lines that...

Other than adding text to the end of lines that start with a #, what is the code you're trying to use doing wrong?

What are you hoping that /DP=/ will print. I would expect it to print 1 if the...
Forum: Shell Programming and Scripting Linux 11-16-2017
Replies: 2
Views: 247
Posted By Yoda
awk -F'\t'...

awk -F'\t' 'NR==FNR{c[$1$3$4]++;next}c[$8$2$3]>0{$1=++n;print}FNR==1' OFS='\t' file1 file2
Forum: Shell Programming and Scripting Linux 10-26-2017
Replies: 6
Views: 562
Posted By Aia
Work from this point. ...

Work from this point.

dir_path=C:/Users/cmccabe/Desktop/annovar
while IFS= read line
do
id=${line%.*}
awk -v F=49 -v T=96 '
BEGIN{ FS=OFS="\t" }
{ b=T+1
...
Showing results 1 to 25 of 500

 


All times are GMT -4. The time now is 03:25 AM.