Getting error while running OS command

Hi team,I am getting below error while running command from go :slight_smile:
fork/exec awk ‘BEGIN{buf=""} /[0-9]:[0-9][0-9]:[0-9]/{buf=$0};/ORA-/{print buf,$0}’ /u02/app/oracle/admin/12.1.0.2/diag/rdbms/*******/******1/trace/alert_******1.log: no such file or directory

When I am trying to run it manually it’s running fine:

[oracle@cfcldx0139 adhoc]$ exec awk ‘BEGIN{buf=""} /[0-9]:[0-9][0-9]:[0-9]/{buf=$0};/ORA-/{print buf,$0}’ /u02/app/oracle/admin/12.1.0.2/diag/rdbms/*******/*******1/trace/alert_*****1.log

Fri Jul 10 08:03:10 2020 ORA-65000 signalled during: ALTER pluggable DATABASE CLOSE immediate…

code below :slight_smile:
search_cmd := “awk 'BEGIN{buf=”"} /[0-9]:[0-9][0-9]:[0-9]/{buf=$0};/ORA-/{print buf,$0}’ " + alert_file

       cmd2 := exec.Command(search_cmd)

What exactly is “search_cmd”? As Golang’s exec behaves similarly to the C exec, it may be restricted to commands within /bin, and such failing to find the binary you want to run.

exec.Command(“bash”, “-c”, searchcmd).Start()

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.