Shell奇技淫巧
Upcoming SlideShare
Loading in...5
×
 

Shell奇技淫巧

on

  • 926 views

 

Statistics

Views

Total Views
926
Views on SlideShare
926
Embed Views
0

Actions

Likes
6
Downloads
23
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Shell奇技淫巧 Shell奇技淫巧 Presentation Transcript

  • Shell奇技 巧 David Xie david.xie@me.com
  • 导读奇技的前奏检查文件内容文件行数/字数检查文件内容替换
  • 奇技的前奏
  • 管道|ps -ewf | grep mac
  • 重定向>>><ls > file.lstecho “xxx.xxx.xxx.xxx” >> /etc/hostsmysql -U root -p < test.sql
  • awkawk -F “ ” ‘{print $1,$2}’
  • sed-i 原地替换‘s/original/new/g’sed -i “” ‘s/class/CLASS/g’ <FILE>
  • xargs对前面结果的每一行做处理ps -ewf | grep daimaduan.com | awk‘{print $2}’ | xargs kill -9
  • 好戏 始 !
  • 检查文件内容find src/ -name ‘*.py’ -type f-name, -type, -user, -group, -size
  • 检查文件内容find src/ -name ‘*.py’ -type f |xargs grep -n -i ‘copyright’
  • 文件行数/字数检查wc -w <FILE>wc -l <FILE>find src/ -name ‘*.py’ | xargs wc -l
  • 文件内容替换find protected/ -name *.php | awk -F ":" {print $1} | xargs sed -i ""s/class/CLASS/g