i recently came across a tricky situation while doing log analysis, am not an expert in REGEX so just wanted to post here and see if i get any good solution
problem: Below i have pasted the result that i got by performing awk and grep command on a unix log file. using awk |sort |uniq -c
`2851 ABC=10087 ACG=123 RMC=17`
`2851 ABC=10087 ACG=123 RMC=17`
`1323 ABC=10087 ACG=123 RMC=10`
`1323 ABC=10087 ACG=123 RMC=20`
`1323 ABC=10087 ACG=123 RMC=20`
`248 ABC=10087 ACG=123 RMC=8`
`248 ABC=10087 ACG=123 RMC=8`
`236 ABC=10087 ACG=123 RMC=7`
`127 ABC=10087 ACG=123 RMC=16`
`127 ABC=10087 ACG=123 RMC=16`
`67 ABC=10087 ACG=123 RMC=1`
I piped this above output ("|") and applied sed command to it to sort 7th feild (i.e RMC values in descending order), so i used this
sed's/=/ / g' |sort -rnk 7,7 .
After sorting the value i again changed the out to look like previous, so i re-applied the sed i used,
sed 's/=/ / g' |sort -rnk 7,7 |sed 's/ /=/g'
This is what i was expecting
`1323 ABC=10087 ACG=123 RMC=20`
`1323 ABC=10087 ACG=123 RMC=20`
`2851 ABC=10087 ACG=123 RMC=17`
`2851 ABC=10087 ACG=123 RMC=17`
`127 ABC=10087 ACG=123 RMC=16`
`127 ABC=10087 ACG=123 RMC=16`
`1323 ABC=10087 ACG=123 RMC=10`
`248 ABC=10087 ACG=123 RMC=8`
`248 ABC=10087 ACG=123 RMC=8`
`236 ABC=10087 ACG=123 RMC=7`
`67 ABC=10087 ACG=123 RMC=1`
but my output looks something like this
`===1323=ABC=10087=ACG=123=RMC=20`
`===1323=ABC=10087=ACG=123=RMC=20`
`===2851=ABC=10087=ACG=123=RMC=17`
`===2851=ABC=10087=ACG=123=RMC=17`
`====127=ABC=10087=ACG=123=RMC=16`
`====127=ABC=10087=ACG=123=RMC=16`
`===1323=ABC=10087=ACG=123=RMC=10`
`====248=ABC=10087=ACG=123=RMC=8`
`====248=ABC=10087=ACG=123=RMC=8`
`====236=ABC=10087=ACG=123=RMC=7`
`=====67=ABC=10087=ACG=123=RMC=1`
How can i achieve my desired output ?