Sed 与 Linux 等价命令代码[zt]

Sed 与 Linux 等价命令代码basename sed 's/\(.*\)\/\([^/]*\)/\2/' or sed 's,.*/,,'
cat sed '' or sed -n '1,$p' or sed '1,$!d'
cat -s sed '/./,/^$/!d'
cat -n sed '=' | sed 'N;s/\n/\t/;s/^/ &/' or sed '=' | sed '$!N;s/\n/ /'
cat -E sed 's/$/\$/'
cat -t sed 's/\t/^I/g'
cut -c n sed 's/\(.\)\{n\}.*/\1/' or sed 's/^.\{(n-1)\}//g;s/\(.\)\(.*\)/\1/g'
cut -c x-y sed 's/\(^.\{y\}\)\(.*\)/\1/g;s/^.\{(x-1)\}//'
cut -d| -f6 sed 's/\(\([^|]*\)\|\)\{6\}.*/\2/'
cp file1 file2 sed 'w file2' file1
expand -t 1 sed 's/\t/ /g'
dirname sed 's/\(.*\)\/\([^/]*\)/\1/' or sed 's,[^/]*$,,'
grep patten sed -n '/patten/p' or sed '/patten/!d'
grep -v patten sed -n '/patten/!p' or sed '/pateen/d'
grep -n patten sed -n '/patten/{=;p}'| sed 'N;s/\n/:/'
head sed -n '1,10p'
head -1 sed -n '1p' or sed 'q'
head -Number sed '1,Number!d' or sed 'Numberq'
paste -s file1 file2 sed ':a;N;s/\n/\t/;ba;' file1 file2 | sed 's/\t\t/\n/'
paste -sdstr sed ':a;N;s/\n/str/;ba'
rev sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'
tac sed -n '1! G;$p;h' or sed -n 'G;$p;h'
tail -1 sed -n '$p' or sed '$!d'
tail -Number sed ':t;$q;N;(Number 1),$D;bt'
tail -f sed -u '/./!d'
tr "\n" " " sed ':a;N;s/\n/ /;ba'
tr "A-Z" "a-z" sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
tr "a-z" "A-Z" sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'
tr -d "12" sed ':a;N;s/\n//;ba' or sed ':a;N;s/\(^.\)*\n\(.*\)/\2\1/;ba'
tr -s 'x' sed 's/\(x\)\(x\{1,\}\)/\1/'
tr -s ' ' sed 's/ \ / /g'
uniq -u sed '$b;N;/^\(.*\)\n\1$/ ! {P;D};:c;$d;s/.*\n//;N;/^\(.*\)\n\1$/{bc};D'
uniq sed 'N;/^\(.*\)\n\1$/!P;D'
wc -l sed -n '$='
wc -c sed ':a;s/./&\n/;P;D;/.\{2,\}\n/ba' t|sed -n '$='
wc -w sed 's/ /\n/g' | sed -n '$='
xargs sed ':a;N;s/\n/ /;ba' or sed -e ':a' -e '$!N;s/\n/ /;ta'

你可能感兴趣的:(#脚本收集区)