add sort row

This commit is contained in:
onceupon 2016-09-02 11:29:05 +08:00 committed by GitHub
parent 81bc838790
commit 1135f82bfa

View File

@ -455,10 +455,16 @@ awk '{s+=$1} END {print s}' filename
```
#####print field start with string (e.g Linux)
```bash
awk '$1 ~ /^Linux/'
```
#####sort a row (e.g. 1 40 35 12 23 --> 1 12 23 35 40)
```bash
awk ' {split( $0, a, "\t" ); asort( a ); for( i = 1; i <= length(a); i++ ) printf( "%s\t", a[i] ); printf( "\n" ); }'
```
##Xargs