Find the answer to your Linux question:
Results 1 to 2 of 2
hi hope u guys are well... i am using a linux command (with system() call in my c++ code) to search all files with in the system and then store ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    15

    how break from find / -wholename= 'somename'>>filename | tail --f filename


    hi
    hope u guys are well... i am using a linux command (with system() call in my c++ code) to search all files with in the system and then store the results in the a file(say filename). i am piping this with tail --f filename to display the results while storing then in file 'filename'...

    now as tail --f breaks when user breaks it( by ctrl +c) i was wondering is there anyother way to break this pipe
    the command i am using is

    find / -wholename= 'somename'>>filename | tail --f filename

    my program doesn't continue until users breaks this command...
    i was wondering whether there is a way to break this command when find is unable to find anynew file and append it to filename after some time interval....


    my english is not very good if what i have written above is unclear please let me know....

    i need to display the files found which are stored in filename at the same time on the terminal....

    if i can not break from tail --f with out user break... is there anyother way e.g. let say that the file filename is checked after every 1 second to see if anything is written to it ...if anything is written to filename it is displayed ...if nothing gets written to file name say uptill 10 seconds the process breaks automatically...

    i am sorry if this is the wrong question for this forum ..if that is the case can you please direct me to which forum i should put this question on thanks...
    thanks

  2. #2
    Just Joined!
    Join Date
    Oct 2007
    Posts
    15
    Quote Originally Posted by bilalb View Post
    hi
    hope u guys are well... i am using a linux command (with system() call in my c++ code) to search all files with in the system and then store the results in the a file(say filename). i am piping this with tail --f filename to display the results while storing then in file 'filename'...

    now as tail --f breaks when user breaks it( by ctrl +c) i was wondering is there anyother way to break this pipe
    the command i am using is

    find / -wholename= 'somename'>>filename | tail --f filename
    Try
    find / -wholename= 'somename' | tee filename

    Valery

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •