Artificial intelligent assistant

How to ignore the lines starts with # using grep / awk cat /etc/oratab #test1:/opt/oracle/app/oracle/product/11.2.0.4:N +ASM2:/grid/oracle/app/oracle/product/11.2.0.4:N # line added by Agent test2:/opt/oracle/app/oracle/product/11.2.0.4:N # line added by Agent test3:/opt/oracle/app/oracle/product/11.2.0.4:N # line added by Agent oracle@node1 [/home/oracle] cat /etc/oratab | grep -v "agent" | awk -F: '{print $2 }' | awk NF | uniq awk NF is to omit blank lines in the output. Only lines starts with # needs to be ignored. Expected output: /grid/oracle/app/oracle/product/11.2.0.4 /opt/oracle/app/oracle/product/11.2.0.4

awk -F: '/^[^#]/ { print $2 }' /etc/oratab | uniq


`/^[^#]/` matches every line the first character of which is not a `#`; `[^` means "none of the charaters before the next (or rather: closing) `]`.

As only the part between the first two colons is needed `-F:' makes`awk`split the line at colons, and`print $2` prints the second part.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 94418f42109b4c6197cf88865f2c1400