Sed / awk and unix command equivalent code
Transfer from: www.chinaunix.net, thank you, SED and UNIX command equivalent code -------------------------------- -------------------------------------------- Cat | SED ': 'cat -s | sed' /.///0 $/ddac | SED '1! g; h; $! d'grep | sed' / patt /! d'grep -v | sed '/ patt / d'head | sed '10q'Head -1 | SED' Q'tail | Sed -e ': a' -e '$;; n; 11, $ d; ba'til -1 | sed' $! d 'tail -f | sed -u' /./ !d'cut -c 10 | SED 'S / (.) {10}. * / 1 /' cut -d: -f4 | sed 's / (([[ ^:] *):.) {4} * / 2 / 'tr AZ az | sed' y / ABCDEFGHIJKLMNOPQRSTUVWXYZ / abcdefghijklmnopqrstuvwxyz / 'tr az AZ | sed' y / abcdefghijklmnopqrstuvwxyz / ABCDEFGHIJKLMNOPQRSTUVWXYZ / 'tr -s' '| sed' S / / / g'tr -d '12' | sed 'h; $! d; g; s / n // g'wc -l | sed -n' $ = 'UNIQ | SED' N; / ^ (. *) N1 $ /! p; d'rev | sed '/n/ !g;s/(.) (. )//'Basename | SED' s,. * /, 'DIRNAME | SED' S, [^ /] * $,, 'xargs | sed -e': a '-e' $! n; s / n / /; ta'paste -sd : | SED -E ': a' -e '$! n; s / n /: /; Ta'cat -n | SED' = '| SED' $! N; S / N / / 'GREP-N | Sed -n '/ patt / {=; p;}' | sed '$! n; s / n /: /' cp orig new | sed 'w new' orig [/ code: 1: 739EB4CEF5] ---- ---------------------- -------------------------------------------------- --- awk and unix command codes would like to thank the equivalent of: fly ash orange --------------------------------- -------------------------------------------- Cat | awk '{ Print} 'cat -s | awk' {blank = nf == 0? blank: 0; if (Blank TAC | awk '{t [nr] = $ 0;} end {for (i = nr; i> = 1; I - PRINT T [I];} 'grep patten | awk' / patten / {print} 'grep -v patten | awk'! / Patten / {print} 'head | awk'