Linux常用命令
rm -rf foldername
grep “searchStr” folder
grep “searchStr” file
grep -i “searchStr” file //case-insensitive
grep -v “searchStr” file //print lines not including the “searchStr”
grep -r “searchStr” filefolder
grep -rn “searchStr” file folder //print the line number
grep -rl “searchStr” file folder //list the files name only
scp users@hostname:folder foler
http://coolshell.cn/articles/9070.html
awk -F, ‘BEGIN {initialziation} {code block} END {final processing}’ filename
//$0代表整行 {code block}执行次数取决于行数,每行执行一次
{OPS=“|” ; print $1,$2}
condition{code block}
NR>1{print $1}
//NR number of row
//NF number of field
//FILENAME file name
//envrionment=>”’$PATH’”
// backward slash \ 可以换行显示
cut -d, -f1,2,3 filename
cut -d, -f1-5 filename
cut -d, -f5- filename
cut -c1,10-20 filename
//wordcount
wc -l filename
sort -t’分隔符’ -k字段序号 filename
options:
-r 反序
-n sort by number
-f ignore case
sort by several column
sort -t’|’ +2 -3 filename
sort -t’|’ -k data.txt
sed = special editor
sed ’s/pattern/replacement/flags’ filename
sed ’s/first/second/2g’ data.txt replace 第二个first
//& ===equal to