The Stack Overflow podcast is back! Listen to an interview with our new CEO.
4 If it is **not** found in the log file; pick line by line values >> each line
source | link

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick line byeach line values from this file and search it in a log file and check if it present or not. If it is nownot found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out what's wrong?

Here is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick line by line values from this file and search it in a log file and check if it present or not. If it is now found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out what's wrong?

Here is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick each line from this file and search it in a log file and check if it present or not. If it is not found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out what's wrong?

Here is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

3 edited body
source | link

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick line by line values from this file and search it in a log file and check if it present or not. IFIf it is now found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out whatswhat's wrong  ?

Here is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick line by line values from this file and search it in a log file and check if it present or not. IF it is now found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out whats wrong  ?

Here is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick line by line values from this file and search it in a log file and check if it present or not. If it is now found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out what's wrong?

Here is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

2 added 82 characters in body; edited title
source | link

AIX::- grep: Not a recognized flag: - in AIX

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txtresult.txt . Now I will pick line by line values from this file and search it in a log file and check if it present or not. IF it is now found in the log file I want to write it in a separate file say notfound.txtnotfound.txt. I am working on a AIX server and getting this below error for the grepgrep command. Can somebody please help me figure out whats wrong ?

while read -r LINE; do grep -q "$LINE" log.log if [ $? -eq 0 ] then echo "$LINE" >> /home/notfound.txt fi done < result.txtHere is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

Thanks in advance

AIX::- grep: Not a recognized flag: -

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick line by line values from this file and search it in a log file and check if it present or not. IF it is now found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out whats wrong ?

while read -r LINE; do grep -q "$LINE" log.log if [ $? -eq 0 ] then echo "$LINE" >> /home/notfound.txt fi done < result.txt

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

Thanks in advance

grep: Not a recognized flag in AIX

I am trying to write a shell which will fetch a set of data from table and write it to a text file whose name is result.txt . Now I will pick line by line values from this file and search it in a log file and check if it present or not. IF it is now found in the log file I want to write it in a separate file say notfound.txt. I am working on a AIX server and getting this below error for the grep command. Can somebody please help me figure out whats wrong ?

Here is my script,

while read -r LINE; do
    grep -q "$LINE" log.log 
    if [  $? -eq 0 ]
    then
       echo "$LINE" >> /home/notfound.txt
    fi
done  < result.txt

which gives me following output,

grep: Not a recognized flag: - Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...]

Usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...]

1
source | link