Platform: Oracle Linux 6.3
From a log file, I want to grep all lines with the pattern "TNS-" but I want to skip those with the pattern "TNS-12514" . How can I do this ?
Platform: Oracle Linux 6.3
From a log file, I want to grep all lines with the pattern "TNS-" but I want to skip those with the pattern "TNS-12514" . How can I do this ?
You can use -v
option to exclude any pattern
grep "TNS-" file.log | grep -v "TNS-12514"
Like this ?
awk '/TNS-/ && !/TNS-12514/' inputfile
cat inputfile
his this is TNS- how
whts is
anyway TNS-12514 this
starnge TNS-456 let tr
output:
his this is TNS- how
starnge TNS-456 let try
perl -ne 'print if /TNS-(?!12514)/' yourfile