Shell實用指令

2021-10-24 10:47:20 字數 491 閱讀 9305

1.cut -f 2 -d 「t」 (用 t 切割,取出第2列,預設的切割符為「\t")

2.sed 「2a ab c」 a.txt (在a.txt檔案中的第2行下增加ab c,不會改變源資料)

sed 「/aa/d」 a.txt (把a.txt檔案中包含aa的字串刪除)

sed 「s/aa/bb/g」 a.txt(把a.txt檔案中,所有的aa替換成bb(g代表全域性的))

3.awk -f : 『/^root/ 』 passwd (用 : 切割passwd中的內容,匹配到以root開頭的行,則輸出該行的第7列)

awk -f : 『begin end』 passwd (在a.txt的開頭加aa,然後以:切割後輸出第1列和第7列,再在結尾輸出bb)

awk 『/^$/ 』 a.txt (在a.txt中,如果匹配到空行,則輸出空行所在行號)

4.sort -t : -nrk 2 a.txt (把a.txt檔案中的內容以:切割,按照第2列數值大小的倒序排列)

實用的AT指令

1 相關的gsm at指令 與sms有關的gsm at指令 from gsm07.05 如表1所示 表1 相關的gsm at指令 at 指令 功 能 at cmgc send an sms command 發出一條短訊息命令 at cmgd delete sms message 刪除sim卡記憶體的...

linux 實用指令

cat file awk f 001 awk f 002 sort uniq c sort rn 對檔案中的某一列求和 cat file awk awk end 對第一列求和 求資料夾下所有檔案的行數總和 find type f exec wc l awk end find type f exec ...

git實用指令

1.強制拉取遠端分支覆蓋本地 git fetch all git reset hard origin master git pull2.刪除分支 位址3.遠端分支刪除後,更新本地分支列表 git remote prune origin持續更新 4 強制推送本地到遠端 有覆蓋遠端 的風險 git pu...