明牯工作室 - 嵌入式软件服务

脚本笔记

| Comments


1 2 3 4
awk sed shell python

sed

  1. FIND AND REPLACE with SED

replace all the words "ugly" with "beautiful":

sed -i 's/ugly/beautiful/g' /home/bruno/old-friends/sue.txt

replace all the words "ugly*" with "beautiful":

sed -i 's/ugly.*/beautiful/g' /home/bruno/old-friends/sue.txt

replace all the words "ugly*" with $VAR:

sed -i 's/ugly.*/'"$VAR"'/g' /home/bruno/old-friends/sue.txt

shell

  1. rmp

rmp command:

rpm -ivh *.rpm              # install
rpm -qpl *.rpm              # list
rpm2cpio *.rpm | cpio -div  # extract

Comments