2016-07-29 7 views

Antwort

0

versuchen dies;

#!/bin/bash 
while read line   
do 
beforeC=$(echo "$line" | cut -f-5 -d';') 
sortcolumn=$(echo "$line" | awk -F ";" '{print $6}' | tr -t , "\n" | sort -r -n | xargs | sed 's/ /,/g') 
afterC=$(echo "$line" | cut -f7- -d';') 
echo -e $beforeC";"$sortcolumn";"$afterC 
done <file 


[email protected]:/tmp/test$ cat file 
00000000000000;000022233333;2;NONE;true;100,100,5,1,28;UNKNOWN 
00000000000000;000022233333;2;NONE;true;99,100,5,1,28;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,99,5,1,28;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,100,4,1,28;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,100,4,0,28;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,100,4,1,27;UNKNOWN 

[email protected]:/tmp/test$ ./sortAColumn.sh 
00000000000000;000022233333;2;NONE;true;100,100,28,5,1;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,99,28,5,1;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,99,28,5,1;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,100,28,4,1;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,100,28,4,0;UNKNOWN 
00000000000000;000022233333;2;NONE;true;100,100,27,4,1;UNKNOWN 
Verwandte Themen