Find command not working in shell script

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a to find for list of words in a list of files. Hence I have put the list of words in a file, and using for loop trying to read each word in a file and use find command to grep for that word in list of found files.



I am using the mentioned flavor of Linux



bash-3.1$ uname
HP-UX


And below mentioned is my shell script.



 #!/bin/sh
PATH="/NO/20171013"
STRING=`/usr/bin/cat /home/test/STAT44_test.txt`
for LINE in $STRING
do
echo "find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l"
LINES=`find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l`
echo "LINES count is $LINES"
if [ $LINES -eq 0 ]
then
echo "In not found"
# echo "$LINE is not found in $PATH" >> /home/test/STAT44_not_found.out
else
echo "In Found"
# echo "$LINE is found in $PATH" >> /home/test/STAT44_found.out
fi
done


The find command find $PATH -type f -name "*.txt" -exec grep -w '$LINE' ; 2>/dev/null works perfectly in the command prompt, whereas it is not at giving any output, if used in the shell script as mentioned above.



The output of echo $? is 0 but the find command doesn't produce any output.



The output of the script is



find /NO/20171013 -type f -name "*.txt" -exec grep -w 655044810645 ; 2>/dev/null | /usr/bin/wc -l
LINES count is 0
In not found
find /NO/20171013 -type f -name "*.txt" -exec grep -w 734729751028 ; 2>/dev/null | /usr/bin/wc -l
LINES count is 0
In not found


Actually the *.txt files under /NO/20171013 has files with pattern 655044810645 and 734729751028 . Hence the Word count should not be 0 and it has to get into else part.



What could be missing?







share|improve this question


























    up vote
    0
    down vote

    favorite












    I have a to find for list of words in a list of files. Hence I have put the list of words in a file, and using for loop trying to read each word in a file and use find command to grep for that word in list of found files.



    I am using the mentioned flavor of Linux



    bash-3.1$ uname
    HP-UX


    And below mentioned is my shell script.



     #!/bin/sh
    PATH="/NO/20171013"
    STRING=`/usr/bin/cat /home/test/STAT44_test.txt`
    for LINE in $STRING
    do
    echo "find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l"
    LINES=`find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l`
    echo "LINES count is $LINES"
    if [ $LINES -eq 0 ]
    then
    echo "In not found"
    # echo "$LINE is not found in $PATH" >> /home/test/STAT44_not_found.out
    else
    echo "In Found"
    # echo "$LINE is found in $PATH" >> /home/test/STAT44_found.out
    fi
    done


    The find command find $PATH -type f -name "*.txt" -exec grep -w '$LINE' ; 2>/dev/null works perfectly in the command prompt, whereas it is not at giving any output, if used in the shell script as mentioned above.



    The output of echo $? is 0 but the find command doesn't produce any output.



    The output of the script is



    find /NO/20171013 -type f -name "*.txt" -exec grep -w 655044810645 ; 2>/dev/null | /usr/bin/wc -l
    LINES count is 0
    In not found
    find /NO/20171013 -type f -name "*.txt" -exec grep -w 734729751028 ; 2>/dev/null | /usr/bin/wc -l
    LINES count is 0
    In not found


    Actually the *.txt files under /NO/20171013 has files with pattern 655044810645 and 734729751028 . Hence the Word count should not be 0 and it has to get into else part.



    What could be missing?







    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a to find for list of words in a list of files. Hence I have put the list of words in a file, and using for loop trying to read each word in a file and use find command to grep for that word in list of found files.



      I am using the mentioned flavor of Linux



      bash-3.1$ uname
      HP-UX


      And below mentioned is my shell script.



       #!/bin/sh
      PATH="/NO/20171013"
      STRING=`/usr/bin/cat /home/test/STAT44_test.txt`
      for LINE in $STRING
      do
      echo "find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l"
      LINES=`find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l`
      echo "LINES count is $LINES"
      if [ $LINES -eq 0 ]
      then
      echo "In not found"
      # echo "$LINE is not found in $PATH" >> /home/test/STAT44_not_found.out
      else
      echo "In Found"
      # echo "$LINE is found in $PATH" >> /home/test/STAT44_found.out
      fi
      done


      The find command find $PATH -type f -name "*.txt" -exec grep -w '$LINE' ; 2>/dev/null works perfectly in the command prompt, whereas it is not at giving any output, if used in the shell script as mentioned above.



      The output of echo $? is 0 but the find command doesn't produce any output.



      The output of the script is



      find /NO/20171013 -type f -name "*.txt" -exec grep -w 655044810645 ; 2>/dev/null | /usr/bin/wc -l
      LINES count is 0
      In not found
      find /NO/20171013 -type f -name "*.txt" -exec grep -w 734729751028 ; 2>/dev/null | /usr/bin/wc -l
      LINES count is 0
      In not found


      Actually the *.txt files under /NO/20171013 has files with pattern 655044810645 and 734729751028 . Hence the Word count should not be 0 and it has to get into else part.



      What could be missing?







      share|improve this question














      I have a to find for list of words in a list of files. Hence I have put the list of words in a file, and using for loop trying to read each word in a file and use find command to grep for that word in list of found files.



      I am using the mentioned flavor of Linux



      bash-3.1$ uname
      HP-UX


      And below mentioned is my shell script.



       #!/bin/sh
      PATH="/NO/20171013"
      STRING=`/usr/bin/cat /home/test/STAT44_test.txt`
      for LINE in $STRING
      do
      echo "find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l"
      LINES=`find $PATH -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | /usr/bin/wc -l`
      echo "LINES count is $LINES"
      if [ $LINES -eq 0 ]
      then
      echo "In not found"
      # echo "$LINE is not found in $PATH" >> /home/test/STAT44_not_found.out
      else
      echo "In Found"
      # echo "$LINE is found in $PATH" >> /home/test/STAT44_found.out
      fi
      done


      The find command find $PATH -type f -name "*.txt" -exec grep -w '$LINE' ; 2>/dev/null works perfectly in the command prompt, whereas it is not at giving any output, if used in the shell script as mentioned above.



      The output of echo $? is 0 but the find command doesn't produce any output.



      The output of the script is



      find /NO/20171013 -type f -name "*.txt" -exec grep -w 655044810645 ; 2>/dev/null | /usr/bin/wc -l
      LINES count is 0
      In not found
      find /NO/20171013 -type f -name "*.txt" -exec grep -w 734729751028 ; 2>/dev/null | /usr/bin/wc -l
      LINES count is 0
      In not found


      Actually the *.txt files under /NO/20171013 has files with pattern 655044810645 and 734729751028 . Hence the Word count should not be 0 and it has to get into else part.



      What could be missing?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 16 '17 at 12:18

























      asked Oct 16 '17 at 8:38









      sabarish jackson

      119112




      119112




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          First, set up a proper $PATH (and see answer by Kamil Maciorowski):



          Logg in with suitable user (root?) and execute:



          echo PATH=$PATH


          Add the output in the start of your script



          OR you can add a full path to find command. If you don't know where find are placed, execute:



          which find


          Output will be like this: /usr/bin/find



          And you have a mistake inside loop:



          You need to replace single quotes with doublequotes (around of $LINE), otherwise the variable will not be interpreted:



          echo "find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l"
          LINES=`find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l`



          Some notes:



          1. You do not need cat file, try to use loop instead. But use only while, not for! Read Why you don't read lines with "for" and How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?





          share|improve this answer






















          • +1 Because you cover issues my answer doesn't (I decided not to duplicate them).
            – Kamil Maciorowski
            Oct 16 '17 at 11:09










          • @Egor Vasilyev OKay I understand the usage of for and while now. But find command isn't returning any output. I even changed the single quotes to double quotes, even then the find isn't returning any output.
            – sabarish jackson
            Oct 16 '17 at 12:01










          • @sabarish jackson, can you update your answer with the latest script code?
            – Egor Vasilyev
            Oct 16 '17 at 12:05










          • @EgorVasilyev I have edited my question with output and edits in script. Please look into it.
            – sabarish jackson
            Oct 16 '17 at 12:19










          • @sabarish jackson, $PATH - is built-in shell variable. You need to use different variable name such as $PATH_TO_FOLDER or something else. See answer by Kamil Maciorowski
            – Egor Vasilyev
            Oct 16 '17 at 12:30


















          up vote
          4
          down vote













          $PATH is important variable with meaning. You should choose another name.



          In this case find executable cannot be found because $PATH doesn't lead to it. You are not notified because of 2>/dev/null.



          echo is probably a shell builtin, it needs no $PATH to work. The same for for etc.






          share|improve this answer




















          • Okay. Now I changed the PATH to PATHS, even then it isn't working. I am getting the below output. /NO/20171013/ 655044810645 734729751028 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '655044810645' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '734729751028' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0
            – sabarish jackson
            Oct 16 '17 at 8:52











          • @steeldriver These backticks may be right. With cat they make the content of STAT44.txt be assigned to the variable.
            – Kamil Maciorowski
            Oct 16 '17 at 10:36










          • @KamilMaciorowski oops you are right - must remember not to post before coffee ;)
            – steeldriver
            Oct 16 '17 at 10:38










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398354%2ffind-command-not-working-in-shell-script%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          First, set up a proper $PATH (and see answer by Kamil Maciorowski):



          Logg in with suitable user (root?) and execute:



          echo PATH=$PATH


          Add the output in the start of your script



          OR you can add a full path to find command. If you don't know where find are placed, execute:



          which find


          Output will be like this: /usr/bin/find



          And you have a mistake inside loop:



          You need to replace single quotes with doublequotes (around of $LINE), otherwise the variable will not be interpreted:



          echo "find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l"
          LINES=`find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l`



          Some notes:



          1. You do not need cat file, try to use loop instead. But use only while, not for! Read Why you don't read lines with "for" and How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?





          share|improve this answer






















          • +1 Because you cover issues my answer doesn't (I decided not to duplicate them).
            – Kamil Maciorowski
            Oct 16 '17 at 11:09










          • @Egor Vasilyev OKay I understand the usage of for and while now. But find command isn't returning any output. I even changed the single quotes to double quotes, even then the find isn't returning any output.
            – sabarish jackson
            Oct 16 '17 at 12:01










          • @sabarish jackson, can you update your answer with the latest script code?
            – Egor Vasilyev
            Oct 16 '17 at 12:05










          • @EgorVasilyev I have edited my question with output and edits in script. Please look into it.
            – sabarish jackson
            Oct 16 '17 at 12:19










          • @sabarish jackson, $PATH - is built-in shell variable. You need to use different variable name such as $PATH_TO_FOLDER or something else. See answer by Kamil Maciorowski
            – Egor Vasilyev
            Oct 16 '17 at 12:30















          up vote
          2
          down vote



          accepted










          First, set up a proper $PATH (and see answer by Kamil Maciorowski):



          Logg in with suitable user (root?) and execute:



          echo PATH=$PATH


          Add the output in the start of your script



          OR you can add a full path to find command. If you don't know where find are placed, execute:



          which find


          Output will be like this: /usr/bin/find



          And you have a mistake inside loop:



          You need to replace single quotes with doublequotes (around of $LINE), otherwise the variable will not be interpreted:



          echo "find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l"
          LINES=`find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l`



          Some notes:



          1. You do not need cat file, try to use loop instead. But use only while, not for! Read Why you don't read lines with "for" and How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?





          share|improve this answer






















          • +1 Because you cover issues my answer doesn't (I decided not to duplicate them).
            – Kamil Maciorowski
            Oct 16 '17 at 11:09










          • @Egor Vasilyev OKay I understand the usage of for and while now. But find command isn't returning any output. I even changed the single quotes to double quotes, even then the find isn't returning any output.
            – sabarish jackson
            Oct 16 '17 at 12:01










          • @sabarish jackson, can you update your answer with the latest script code?
            – Egor Vasilyev
            Oct 16 '17 at 12:05










          • @EgorVasilyev I have edited my question with output and edits in script. Please look into it.
            – sabarish jackson
            Oct 16 '17 at 12:19










          • @sabarish jackson, $PATH - is built-in shell variable. You need to use different variable name such as $PATH_TO_FOLDER or something else. See answer by Kamil Maciorowski
            – Egor Vasilyev
            Oct 16 '17 at 12:30













          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          First, set up a proper $PATH (and see answer by Kamil Maciorowski):



          Logg in with suitable user (root?) and execute:



          echo PATH=$PATH


          Add the output in the start of your script



          OR you can add a full path to find command. If you don't know where find are placed, execute:



          which find


          Output will be like this: /usr/bin/find



          And you have a mistake inside loop:



          You need to replace single quotes with doublequotes (around of $LINE), otherwise the variable will not be interpreted:



          echo "find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l"
          LINES=`find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l`



          Some notes:



          1. You do not need cat file, try to use loop instead. But use only while, not for! Read Why you don't read lines with "for" and How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?





          share|improve this answer














          First, set up a proper $PATH (and see answer by Kamil Maciorowski):



          Logg in with suitable user (root?) and execute:



          echo PATH=$PATH


          Add the output in the start of your script



          OR you can add a full path to find command. If you don't know where find are placed, execute:



          which find


          Output will be like this: /usr/bin/find



          And you have a mistake inside loop:



          You need to replace single quotes with doublequotes (around of $LINE), otherwise the variable will not be interpreted:



          echo "find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l"
          LINES=`find $PATHS -type f -name "*.txt" -exec grep -w "$LINE" ; 2>/dev/null | wc -l`



          Some notes:



          1. You do not need cat file, try to use loop instead. But use only while, not for! Read Why you don't read lines with "for" and How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 16 '17 at 10:39

























          answered Oct 16 '17 at 9:26









          Egor Vasilyev

          1,792129




          1,792129











          • +1 Because you cover issues my answer doesn't (I decided not to duplicate them).
            – Kamil Maciorowski
            Oct 16 '17 at 11:09










          • @Egor Vasilyev OKay I understand the usage of for and while now. But find command isn't returning any output. I even changed the single quotes to double quotes, even then the find isn't returning any output.
            – sabarish jackson
            Oct 16 '17 at 12:01










          • @sabarish jackson, can you update your answer with the latest script code?
            – Egor Vasilyev
            Oct 16 '17 at 12:05










          • @EgorVasilyev I have edited my question with output and edits in script. Please look into it.
            – sabarish jackson
            Oct 16 '17 at 12:19










          • @sabarish jackson, $PATH - is built-in shell variable. You need to use different variable name such as $PATH_TO_FOLDER or something else. See answer by Kamil Maciorowski
            – Egor Vasilyev
            Oct 16 '17 at 12:30

















          • +1 Because you cover issues my answer doesn't (I decided not to duplicate them).
            – Kamil Maciorowski
            Oct 16 '17 at 11:09










          • @Egor Vasilyev OKay I understand the usage of for and while now. But find command isn't returning any output. I even changed the single quotes to double quotes, even then the find isn't returning any output.
            – sabarish jackson
            Oct 16 '17 at 12:01










          • @sabarish jackson, can you update your answer with the latest script code?
            – Egor Vasilyev
            Oct 16 '17 at 12:05










          • @EgorVasilyev I have edited my question with output and edits in script. Please look into it.
            – sabarish jackson
            Oct 16 '17 at 12:19










          • @sabarish jackson, $PATH - is built-in shell variable. You need to use different variable name such as $PATH_TO_FOLDER or something else. See answer by Kamil Maciorowski
            – Egor Vasilyev
            Oct 16 '17 at 12:30
















          +1 Because you cover issues my answer doesn't (I decided not to duplicate them).
          – Kamil Maciorowski
          Oct 16 '17 at 11:09




          +1 Because you cover issues my answer doesn't (I decided not to duplicate them).
          – Kamil Maciorowski
          Oct 16 '17 at 11:09












          @Egor Vasilyev OKay I understand the usage of for and while now. But find command isn't returning any output. I even changed the single quotes to double quotes, even then the find isn't returning any output.
          – sabarish jackson
          Oct 16 '17 at 12:01




          @Egor Vasilyev OKay I understand the usage of for and while now. But find command isn't returning any output. I even changed the single quotes to double quotes, even then the find isn't returning any output.
          – sabarish jackson
          Oct 16 '17 at 12:01












          @sabarish jackson, can you update your answer with the latest script code?
          – Egor Vasilyev
          Oct 16 '17 at 12:05




          @sabarish jackson, can you update your answer with the latest script code?
          – Egor Vasilyev
          Oct 16 '17 at 12:05












          @EgorVasilyev I have edited my question with output and edits in script. Please look into it.
          – sabarish jackson
          Oct 16 '17 at 12:19




          @EgorVasilyev I have edited my question with output and edits in script. Please look into it.
          – sabarish jackson
          Oct 16 '17 at 12:19












          @sabarish jackson, $PATH - is built-in shell variable. You need to use different variable name such as $PATH_TO_FOLDER or something else. See answer by Kamil Maciorowski
          – Egor Vasilyev
          Oct 16 '17 at 12:30





          @sabarish jackson, $PATH - is built-in shell variable. You need to use different variable name such as $PATH_TO_FOLDER or something else. See answer by Kamil Maciorowski
          – Egor Vasilyev
          Oct 16 '17 at 12:30













          up vote
          4
          down vote













          $PATH is important variable with meaning. You should choose another name.



          In this case find executable cannot be found because $PATH doesn't lead to it. You are not notified because of 2>/dev/null.



          echo is probably a shell builtin, it needs no $PATH to work. The same for for etc.






          share|improve this answer




















          • Okay. Now I changed the PATH to PATHS, even then it isn't working. I am getting the below output. /NO/20171013/ 655044810645 734729751028 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '655044810645' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '734729751028' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0
            – sabarish jackson
            Oct 16 '17 at 8:52











          • @steeldriver These backticks may be right. With cat they make the content of STAT44.txt be assigned to the variable.
            – Kamil Maciorowski
            Oct 16 '17 at 10:36










          • @KamilMaciorowski oops you are right - must remember not to post before coffee ;)
            – steeldriver
            Oct 16 '17 at 10:38














          up vote
          4
          down vote













          $PATH is important variable with meaning. You should choose another name.



          In this case find executable cannot be found because $PATH doesn't lead to it. You are not notified because of 2>/dev/null.



          echo is probably a shell builtin, it needs no $PATH to work. The same for for etc.






          share|improve this answer




















          • Okay. Now I changed the PATH to PATHS, even then it isn't working. I am getting the below output. /NO/20171013/ 655044810645 734729751028 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '655044810645' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '734729751028' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0
            – sabarish jackson
            Oct 16 '17 at 8:52











          • @steeldriver These backticks may be right. With cat they make the content of STAT44.txt be assigned to the variable.
            – Kamil Maciorowski
            Oct 16 '17 at 10:36










          • @KamilMaciorowski oops you are right - must remember not to post before coffee ;)
            – steeldriver
            Oct 16 '17 at 10:38












          up vote
          4
          down vote










          up vote
          4
          down vote









          $PATH is important variable with meaning. You should choose another name.



          In this case find executable cannot be found because $PATH doesn't lead to it. You are not notified because of 2>/dev/null.



          echo is probably a shell builtin, it needs no $PATH to work. The same for for etc.






          share|improve this answer












          $PATH is important variable with meaning. You should choose another name.



          In this case find executable cannot be found because $PATH doesn't lead to it. You are not notified because of 2>/dev/null.



          echo is probably a shell builtin, it needs no $PATH to work. The same for for etc.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 16 '17 at 8:46









          Kamil Maciorowski

          1,0791523




          1,0791523











          • Okay. Now I changed the PATH to PATHS, even then it isn't working. I am getting the below output. /NO/20171013/ 655044810645 734729751028 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '655044810645' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '734729751028' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0
            – sabarish jackson
            Oct 16 '17 at 8:52











          • @steeldriver These backticks may be right. With cat they make the content of STAT44.txt be assigned to the variable.
            – Kamil Maciorowski
            Oct 16 '17 at 10:36










          • @KamilMaciorowski oops you are right - must remember not to post before coffee ;)
            – steeldriver
            Oct 16 '17 at 10:38
















          • Okay. Now I changed the PATH to PATHS, even then it isn't working. I am getting the below output. /NO/20171013/ 655044810645 734729751028 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '655044810645' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '734729751028' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0
            – sabarish jackson
            Oct 16 '17 at 8:52











          • @steeldriver These backticks may be right. With cat they make the content of STAT44.txt be assigned to the variable.
            – Kamil Maciorowski
            Oct 16 '17 at 10:36










          • @KamilMaciorowski oops you are right - must remember not to post before coffee ;)
            – steeldriver
            Oct 16 '17 at 10:38















          Okay. Now I changed the PATH to PATHS, even then it isn't working. I am getting the below output. /NO/20171013/ 655044810645 734729751028 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '655044810645' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '734729751028' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0
          – sabarish jackson
          Oct 16 '17 at 8:52





          Okay. Now I changed the PATH to PATHS, even then it isn't working. I am getting the below output. /NO/20171013/ 655044810645 734729751028 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '655044810645' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0 find /NO/20171013/ -type f -name "*.txt" -exec grep -w '734729751028' ; 2>/dev/null | /usr/bin/wc -l 0 LINES 0
          – sabarish jackson
          Oct 16 '17 at 8:52













          @steeldriver These backticks may be right. With cat they make the content of STAT44.txt be assigned to the variable.
          – Kamil Maciorowski
          Oct 16 '17 at 10:36




          @steeldriver These backticks may be right. With cat they make the content of STAT44.txt be assigned to the variable.
          – Kamil Maciorowski
          Oct 16 '17 at 10:36












          @KamilMaciorowski oops you are right - must remember not to post before coffee ;)
          – steeldriver
          Oct 16 '17 at 10:38




          @KamilMaciorowski oops you are right - must remember not to post before coffee ;)
          – steeldriver
          Oct 16 '17 at 10:38

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398354%2ffind-command-not-working-in-shell-script%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?