Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: shashi792
2,162
Posted By Franklin52
awk doesn't have an option to edit files "in...
awk doesn't have an option to edit files "in place". You can do something like this if the command works fine:
awk '{printf("%s%s",NL,$0);NL=RS}' file > newfile && mv newfile file

BTW: That's...
4,133
Posted By Franklin52
Try this: awk 'NR==FNR{a[NR]=$1; next}FNR in...
Try this:
awk 'NR==FNR{a[NR]=$1; next}FNR in a{print a[FNR], $0}' file1 file2
2,441
Posted By rdcwayx
awk ' BEGIN{print "depth\ttemp\tsalinity"} ...
awk '
BEGIN{print "depth\ttemp\tsalinity"}
/<Depth/ {split($2,a,"\"");depth=a[2]}
/<Temperature/ {getline;temp=$1}
/<Salinity/ {getline;salinity=$1;printf "%d\t%d\t%d\n",depth,temp,salinity}
'...
2,579
Posted By danmero
awk 'END{print l}{if(i>=$2||!i){i=$2;l=$2FS$1}}'...
awk 'END{print l}{if(i>=$2||!i){i=$2;l=$2FS$1}}' file
2,579
Posted By rdcwayx
Do you need ouput the freq or both freq & loss? ...
Do you need ouput the freq or both freq & loss?


$ cat urfile

Freq Loss
10 30
20 40
30 10
40 50
50 6

$ awk 'NR==1 {print;loss=999999;next}...
2,579
Posted By bartus11
awk...
awk 'NR==1{min=$2}{a[$2]=$1;if($2<min)min=$2}END{print "Min Loss: "min," Freq: "a[min]}' file > out.txt
6,629
Posted By Corona688
Not really. A character terminal displays...
Not really. A character terminal displays fixed-size, fixed-width characters by definition; you can't selectively resize certain bits. Change colors, yes, change size, no. The unicode subscript...
1,757
Posted By bartus11
awk 'NR==7{min=$3;max=$3}NR>7{if...
awk 'NR==7{min=$3;max=$3}NR>7{if ($3>max){max=$3};if ($3<min){min=$3}}END{print "min: "min" max: "max}' file
Showing results 1 to 8 of 8

 

Featured Tech Videos

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