Skip to content

joshnorwich/Shell-Tips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

AWK OPERATORS

AND

# any order
awk '/pattern1/ && /pattern2/' PATH
# specific order
awk '/pattern1.*pattern2/' PATH			

OR

awk '/pattern1|pattern2/' PATH

NOT

awk '!/pattern/' PATH

##Examples

  • Find all php files whose CONTENTS have changed in the last seven days and look for any strings that don't contain "nextend"
find -type f -name "*.php" -ctime -7 | sed -n '/nextend/!p'
find -type f -name '*.php' -ctime -7 | awk '!/nextend/'
  • Find all php files whose contents have changed between FIRST DATE and SECOND DATE
find -type f -name "*.php" -newerct 2016-01-29 ! -newerct 2016-02-24
  • Actively watch the access log and show all lines containing "POST" but not "404"
tail -f access_log | sed -n '/POST/!d; /404/!p'
tail -f access_log | awk '/POST/ && !/404/'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published