Hi ,

Like a Cat or Grep funcions into linux exist a command similar ??

Want do this but with php :

"cat carlos.conf | grep IP | cut -d = -f 2 | cut -d \ -f 10"

then retrieve just the IP address.

How can i do this over PHP and store into a variable ?

then i will make this :

"perl -i -se 's/$oldIP/$newIP/g' carlos.conf"

The oldIP variable it's the IP that the command cat carlos.conf (bottom) take .

How then a do this into a PHP script ???

Thanks .

    can't you just use the exec command? are you on a *nix or BSD machine?

      exec() is less portable. Just read in the file, use regexps to find what you want, substring the characters you want from each line, ...

      And why are you wanting to use PERL? This is a very small task you are doing, so either do it in PERL, or PHP, not both.

        Sure . =)

        But ok then how over PHP can i read a single line from a text file ?

        Ie. net.conf (have inside)
        -------Net.conf contents.
        IP=192.168.1.0
        NM=255.255.255.0


        Over php how can i just read the second line of this file and put into the screen ?

        The best it's read the line that i want put into the screen and have a choice to change too .
        But i this it's much to ask =) , just please help and tell how then read the line that i want and send to screen .

        Thanks =)

        Well why use perl with php ? When i don''t know much about php , i think mix things some cases work =)

          Use file(filname) --
          this returns an array of lines
          then say $lines[2] for second line

          Mandar

            Write a Reply...