anancds / document

MIT License
1 stars 0 forks source link

awk、sed、find、grep #36

Open anancds opened 4 years ago

anancds commented 4 years ago

find . -name "*.txt" -type f -mtime -30 -size -19k -perm 644

anancds commented 4 years ago

find . -name "*.txt" -type d

anancds commented 4 years ago

find . -name "*.txt" -type f -mtime -1

anancds commented 4 years ago

find . -name "*.txt" -type f -mtime -1 | xargs rm -rf {} \;

anancds commented 4 years ago

find . -name "*.txt" -type f -mtime -1 -exec cp {} /tmp/ \;

anancds commented 4 years ago

find . -name "*.txt" -type f -mtime -30 -size -19k

anancds commented 4 years ago

find . -name "*.txt" -type f -mtime -30 -size -19k -perm 644 -exec chmod -R 755 {} \;

anancds commented 4 years ago

grep -n --color "root" /etc/passwd

anancds commented 4 years ago

grep -v "#" nginx.conf | grep -v "^$"

anancds commented 4 years ago

awk '{print $1}' test.txt

anancds commented 4 years ago

awk '{print $NF}' test.txt

anancds commented 4 years ago

awk -F: '{print $1,$NF}' test.txt

anancds commented 4 years ago

双引号在awk里面表示添加的意思

awk -F: '{print $1"test"$NF}' test.txt

anancds commented 4 years ago

ifconfig | grep "127" | awk '{print $2}' | awk -F. '{print $1"-"$2"-"$3"-"$4}'