Search Results

Search: Posts Made By: MBarrett1213
2,637
Posted By RudiC
awk 'NR==1 {print "0", $0; next} {print 1+gsub...
awk 'NR==1 {print "0", $0; next} {print 1+gsub (/X/,"&",$0), $0}' file | sort -k1,1 | awk '{sub ($1 " ", "")}1'
A B C
3 3 3
4 4 4
9 9 9
1 1 X
2 X 2
5 X 5
6 6 X
7 X X
X 8 X
2,637
Posted By senhia83
A crude way, I`m sure there is better solution ...
A crude way, I`m sure there is better solution

awk -F"X" 'NR==1{$0= $0" D"} NR>1{ $0=$0" "NF}1' infile| awk 'NR<2{print $0;next}{print $0| "sort -nk4,4"}' | awk '{print $1,$2,$3}'
Showing results 1 to 2 of 2

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