1 Reply Latest reply: Jun 14, 2013 10:11 AM by DK2010 RSS

    Need to get a particular string from a file!!



          In a linux server,i need to pull some data from the logfiles from the dir "


      /dev/bld/autosys/autosys-be/jobs/",under this dir we have so many applications like- ada-2013.06.0,bda-2013.06.0,cda-2013.06.0 etc...


            Which are also directories(


      ada-2013.06.0,bda-2013.06.0,cda-2013.06.0) under this each dir ,we can find a logfile.

            from the logfile we need to pull some data to generate a report.


             Here in the logfile we could find a request name "xyz


      -sib_ada-2013.06.0" after the string "ci-" in every part of logfile,so i would like to pull this information from the logfle after that i would like to issues the command "p4 branch xyz-sib_ada-2013.06.0" to get source and target details.


      if you issue the above command it looks like...



      Update: 2013/05/13 12:25:28

      Access: 2013/05/31 13:48:56

      user : xxx

              Created by xxxx

      status :        unlocked

              //xyz-sib/fb-download-app/ada-server/mda-2013.05.0/... //xyz-sib/fb-download-app/ada-server/mda-2013.06.0/...


      here i would like to pull the string as source thing as    //xyz-sib/fb-download-app/ada-server/mda-2013.05.0/


      target    -



        • 1. Re: Need to get a particular string from a file!!



          Its very hared to understand what you want, if i understand correctly  you want to find some set of string from the files  in a diretory

          if yes you can do something like this

          cd /dev/bld/autosys/autosys-be/jobs/

          find . -type f -exec grep "<string you want to serch>" {} \; -print

          It will list the file having some set of string you are serching..