Search Results

Search: Posts Made By: quincyjones
2,084
Posted By RudiC
Try this for medians: awk -F"\t" ' NR == 1 ...
Try this for medians:
awk -F"\t" '
NR == 1
NR > 1 {for (i=2; i<=NF; i++) print $1, i, $i | "sort -k1,2 -k3bn > TMP"
}

function PRMED() {printf TFS "%s", MEDIAN...
2,123
Posted By RavinderSingh13
Hello quincyjones, Could you please try...
Hello quincyjones,

Could you please try following and let me know if this helps you. This should remove if any carriage characters there and will provide the output as TAB delimited too.

awk...
2,123
Posted By RavinderSingh13
Hello quincyjones, Could you please try...
Hello quincyjones,

Could you please try following and let me know if this helps you.

awk '{printf("%s ",$1);for(i=2;i<=NF;i+=2){printf("%s ",$i)};print ""}' Input_file
Thanks,
R. Singh
4,700
Posted By RudiC
Try join file[12] john 20 60 bob 30 100 ...
Try
join file[12]
john 20 60
bob 30 100
or
paste file[12]
john 20 john 60
bob 30 bob 100
2,209
Posted By RudiC
Try awk ' {LN[$1]; HD[$2];...
Try awk ' {LN[$1]; HD[$2]; MX[$1,$2]=$3}
END { printf "%10s", ""; for (i in HD) printf "%10s", i; print "";
for (j in LN) {printf "%10s",j; ...
1,623
Posted By cjcox
off the top of my head: awk '{ for...
off the top of my head:


awk '{
for (i=1;i<=NF;i++) {
if (i%2) {
oname=$i
} else {
ename=$i
printf("%s_%s ",ename,oname);
}
}


Doesn't preserve the...
2,273
Posted By RudiC
I guess you want to sum up the (per row) ANDed...
I guess you want to sum up the (per row) ANDed values of the respective columns. Try awk '
NR==1 {for (i=1; i<=NF; i++) HD[i]=$i
if (MXNF < NF) MXNF=NF
...
1,530
Posted By Chubler_XL
How about one of these two: awk...
How about one of these two:

awk '{c[$1];$1=$1 OFS length(c)}1' infile


awk '
!($1 in c){c[$1]=++U}
$1=$1 OFS c[$1]' infile
2,260
Posted By RudiC
You had a very similar thread some time ago. Any...
You had a very similar thread some time ago. Any learnings from that?

However, try
awk ' {LN[$1]; HD[$2]; MX[$1,$2]++}
END { printf "%10s", ""; for (i in HD)...
4,090
Posted By RudiC
This is not as easy as it seems in the first...
This is not as easy as it seems in the first place. Given you spell "Name" with uppercase "N" and that "N" sorts below all lower case letters, you could try like awk -f transp.awk file | LC_ALL=C...
5,450
Posted By RudiC
awk 'NR==1 {for (i=1; i<=NF; i++) {if (!($i...
awk 'NR==1 {for (i=1; i<=NF; i++) {if (!($i in GRCNT)) GR++
GRCNT[$i]++
if (!GRMIN[$i]) GRMIN[$i]=i+1
...
5,450
Posted By RudiC
Sorry for the headers. For the group counts, I...
Sorry for the headers. For the group counts, I didn't consider that one line can have several groups fulfilling the requirements. Tryawk 'NR==1 {for (i=1; i<=NF; i++) {GRCNT[$i]++
...
5,450
Posted By RudiC
Try awk 'NR==1 {for (i=1; i<=NF; i++) ...
Try awk 'NR==1 {for (i=1; i<=NF; i++) {GRCNT[$i]++
if (!GRMIN[$i]) GRMIN[$i]=i+1
GRMAX[$i]=i+1
...
1,959
Posted By Don Cragun
I'm not sure what you mean by "small code tags",...
I'm not sure what you mean by "small code tags", but the button marked </> at the far right at the top of your editing screen when editing or creating a new post produces and tags which use the...
1,959
Posted By Don Cragun
The awk script: awk '{print $0} OFS = "\n"'...
The awk script:
awk '{print $0} OFS = "\n"' file
can be more clearly written in this case as:
awk '
{print $0}
OFS = "\n"
' file
Since there is no condition on the line {print $0} the action...
4,790
Posted By RudiC
How about awk 'FNR>1 {for(i=2; i<=NF; i++)...
How about awk 'FNR>1 {for(i=2; i<=NF; i++) if($i!=0) next } 1' file
5,450
Posted By RudiC
Don't edit posts modifying samples pulling the...
Don't edit posts modifying samples pulling the rug from under me.

However, the reason was the group "gn" not being sorted after g1 and g2 but before within awk's arrays. I should have added that...
5,450
Posted By RudiC
Well, try this - developed for your former sample...
Well, try this - developed for your former sample it seems to work with the actual one:awk 'NR==1 {for (i=1; i<=NF; i++) GRCNT[$i]++
# ...
5,450
Posted By RavinderSingh13
Hello quincyjones, Could you please try...
Hello quincyjones,

Could you please try following and let me know if this helps.(Little addition to Corona's code)

awk 'BEGIN{ T=0} ; {if(NR==1){print $0} else if(NR>1){for (i=2;i<=NF;i++) if...
5,450
Posted By Corona688
NF is the number of fields. If T is greater...
NF is the number of fields.

If T is greater than 80% of NF, print.
2,055
Posted By RavinderSingh13
Hello quincyjones, Could you please try...
Hello quincyjones,

Could you please try following and let us know if this helps.

awk '{X[$1];Y[$2];Z[$1,$2]=$3}
END{
printf "%20s",""; for(i in X) printf "%10s",i;print "";
for(j in Y)...
1,342
Posted By RudiC
Not the slightest attempt from your side? Try...
Not the slightest attempt from your side?
Try awk 'NR==1 {ln2=log(2); print; next}
{sum=0
for (i=2; i<=NF; i++)
...
906
Posted By bartus11
Try:for i in /path/*.rnk; do java -jar commands...
Try:for i in /path/*.rnk; do java -jar commands -res $i -out ${i%.*} -gui false; done
1,037
Posted By Scrutinizer
Try something like: awk ' NR==1{ ...
Try something like:
awk '
NR==1{
n=split($0,Header)
next
}
{
for(i=2; i<=NF; i++) {
if($i>0.5) Total[i]++
if($i<-0.5) Total[i]--
}
}
END{
...
2,903
Posted By anbu23
$ awk ' NR == 1 { for(i=1;i<=NF;i++) a[i]=$i } ...
$ awk ' NR == 1 { for(i=1;i<=NF;i++) a[i]=$i }
> NR > 1 { for(i=1;i<=NF;i++) arr[i]+=$i }
> END { for(i=1;i<=NF;i++) { if( arr[i] > 0 ? arr[i] : -1 * arr[i] > 0.5) print a[i] ":" arr[i] } } ' file...
Showing results 1 to 25 of 53

 
All times are GMT -4. The time now is 07:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy