"Shell Scripting Learning-2"

Source: Internet
Author: User
Tags locale

#!/bin/bash-#echo do what exetuate this project \nprintf "Please input your passwd" Stty-echoread Pass </dev/ttyp rintf "Please agein input your passwd" read Pass2 </dev/ttystty echo#tr-s > 1.txt | Sort > 2.txt#echo "1 6 8 1 4 9" > 1.txt | Sort 1.txt | Tail 1.txt #cat/dev/null#!/bin/bash#cat/bin/liupeng | grep a | WC #$1#read $x #echo $x #set-x #跟踪 #echo firset echo#set +x #取消跟踪 #echo Second echo#locale-a | grep "^l" #环境变量 #lc_all=da locale ck lc_time######------------------------------grep+ Regular Expressions-----------------------------# #who | Grep-f U1 #判断登录用户 #cat 1.txt | grep ^a | grep b$ #cat 1.txt | grep aa.aa #[aa]d #含有Aa的字符 #cat 1.txt | grep ^aa #以Aa开头的字符 #cat 1.txt | grep aa$ #以Aa结尾的字符 #cat 1.txt | grep [[:d igit:]] | grep ^2 #匹配含有数字的行列 #cat 1.txt | grep [[: Alnum:]] #cat 1.txt | grep \digit #cat 1.txt | grep ab*c #匹配含有一个a额字符 #cat 1.txt | grep [[: upper:]]\{3\}$ #匹配后三位为大写的字符 #cat 1.txt | grep ab?c #匹配ab和abc #cat 1.txt | grep ab+c#----------------------------------sed+ Regular expression _______________________________#sed ' s/:.*//'/root/1.txt#find/root-type d-print#mkdir-p/home/1#sed ' s;/home/1;/home/2; ' # Cat/root/1.txt | Sed ' s/a/b/g ' #替换字符 #n #printf "Hello World" #sed-n '/c/p ' *.txt#sed-n ' $p ' "$" #sed-n ' 2,5p '/root/1.txt #匹配打印的行数echo "h Ello World "| Sed ' s/world/shell/' #替换指定的字符

Shell Scripting Learning-2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.