sort + awk 排序后取第一条

docker images排除latest,tag排序,输出每个镜像第一(或最后)一条


root@master:~#  docker images | grep -v REPOSITORY | sort -t $'\t' -r -k 2 | awk 'BEGIN{n=""}n!=$1 && !/latest/{n=$1;print $1":"$2}'
ubuntu:18.04
python:3-alpine
mongo:4.2.1-bionic
maven:3
mariadb:10
i386/alpine:3.10.3
golang:alpine3.7
bitnami/redis:4.0.8-r2
bitnami/kafka:2.3.1-debian-9-r21
bestwu/qq:office
alpine:3.7

你可能感兴趣的:(linux,awk,sort,docker)