linux - How to search multiple patterns in using grep command? -
i learning use grep , tried use following commands find entries in /var/log/messages file, errors:
grep "oct 23 21:22:44" | "80" /var/log/messages i error this. tried following , replaced double quotes single quotes:
grep 'oct 23 21:22:44' | '80' /var/log/messages this did not work either. why wrong because can search multiple patterns using pipe! because oct 23 21:22:44 , 80 in different places!
80 , date in different orders in file!
this syntax:
grep "oct 23 21:22:44" | "80" /var/log/messages is equivalent running grep , pass output file called 80.
a way need enabling -e option (--extended-regexp) able use | as-is, this:
grep -e "oct 23 21:22:44|80" /var/log/messages
Comments
Post a Comment