This discussion is archived
1 Reply Latest reply: Jun 14, 2013 8:11 AM by DK2010 RSS

Need to get a particular string from a file!!

446 Newbie
Currently Being Moderated


Hi-

    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...

 

Branch:xyz-sib_ada-2013.06.0

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

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

user : xxx

Description:
        Created by xxxx

status :        unlocked

View:
        //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    -

 

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

  • 1. Re: Need to get a particular string from a file!!
    DK2010 Guru
    Currently Being Moderated

    Hi,

     

    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..

     

    HTH

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points