I need to match a line ONLY if it starts with the @ symbol and also contains a single 'A' character, not in a string with other characters. Just the @ and the A need, not SOA for example. Trying to this with grep -P method.
Zone file fragment:
@            IN     SOA     some.bogus.com hostmaster.bogus.com. (
@            IN     A       12.34.56.789
             IN     A       012.345.678.9
@     1800   IN     AAAA    789237:mou68:028n:0000:8afn:
@            IN     NS      ns500.mydummy.server.
@            IN     TXT     "v=spf1 mx ~all"
Using grep -P "(^|\s)\K@(?=\s|$)" myzonefile.com get the lines with @ symbol just fine, but how do I modify it to get the lines with the @ symbol AND with a single 'A' character?
This grep -P '(?=.*@)(?=.*A)' myzonefile.com gets the second line, which is correct, but also gets the SOA line, which I do not want.
This grep -E '\b[A]\s' myzonefile.com gets all lines with single 'A' character only but I have been unable to include an AND operation to also match the @ sign too without piping to another grep. SO not an option.
Should I use sed or awk for this, better suited?
 
     
     
     
    