I needed to search data for one or the other term, but not both.
With this kind of data:
abc:def:ghi:jkl
abc:ghi:jkl:mno
ghi:jkl:mno:pqr
def:abc:jkl:ghi
def:abc:jkl:pqr
def:jkl:pqr:stu
Looking for abc or ghi, but not both, these work (same idea):
awk '!(/abc/&&/ghi/)' datafile|awk '(/abc/||/ghi/)'
egrep -v 'abc.*ghi|ghi.*abc' datafile |egrep "abc|ghi"
Is there anything awk or grep that is more concise? Any way to do it with sed?
Wanda Round