Search Results

Search: Posts Made By: horsepower
2,654
Posted By Scrutinizer
Try: awk '$1==10{$2--; $3=$2/17.2} 1'...
Try:
awk '$1==10{$2--; $3=$2/17.2} 1' CONVFMT="%7.2f" file | sed 's/^10 / 10 /g'
or
awk '$1==10{sub($2 "[ \t]*" $3, sprintf("%d %7.2f", --$2, $2/17.2))}1' file
or
awk...
2,654
Posted By RavinderSingh13
Hello horsepwoer, Could you please try...
Hello horsepwoer,

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

awk '$1 == 10 {$2-=1;$3=$2/1720*100;printf "\t\t%d\t\t%d %.2f\n",$1, $2, $3;next} 1' Input_file

...
15,777
Posted By Scrutinizer
Try: sbin7=2 awk -v n=300 -v corr="$sbin7"...
Try:
sbin7=2
awk -v n=300 -v corr="$sbin7" '$1==n{$2-=corr} {printf "%9d %5d %7.2f\n",$1,$2,$3}' file

Note that this adaptation is needed because file your format is different from the sample in...
15,777
Posted By RudiC
awk '$1 == 300 {$2-=sbin7} 1' sbin7="$sbin7" file...
awk '$1 == 300 {$2-=sbin7} 1' sbin7="$sbin7" file
10 6
300 2
303 1
15,777
Posted By Akshay Hegde
awk -vsbin7="$sbin7" '{ print $1,$2-($1 == 300 ?...
awk -vsbin7="$sbin7" '{ print $1,$2-($1 == 300 ? sbin7 : 0),$3}' tmp.txt
OR
awk '{ print $1,$2-($1 == 300 ? sbin7 : 0),$3}' sbin7="$sbin7" tmp.txt
15,777
Posted By anbu23
Can you add code tags? awk '{ print...
Can you add code tags?

awk '{ print $1,$2-($1 == 300 ? '$sbin7' : 0),$3}' tmp.txt
Showing results 1 to 6 of 6

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