0

I need to find in Perl source files lines containing bin/exim|SendEmail|Unformatted except of comment lines (lines starting with # with possible whitespace before).

I know how to do it with a pipeline of several invocations of FreeBSD grep command. Can it be done with only one grep (not a pipeline)?

porton
  • 323

1 Answers1

1

Try this :

grep -e "^[^#]*bin/exim.*" -e "^[^#]*SendEmail.*" -e "^[^#]*Unformatted.*" test.txt

i've try it with this file

# test
#test 
 # test
#test
test
toto
#toto
# toto
test
toto
test
#bin/exim 
#SendEmail
#Unformatted
# bin/exim
# SendEmail
# Unformatted
 # bin/exim
 # SendEmail
 # Unformatted
 #bin/exim
 #SendEmail
 #Unformatted
bin/exim
SendEmail
Unformatted
Romain
  • 126