Find the answer to your Linux question:
Results 1 to 2 of 2
I have this PHP Program I have been hobbying for years. Started in old PHP3 early PHP4. So with the newer PHP, things are starting to break! I have this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    1

    Replace strings CONTAINING apostrophes


    I have this PHP Program I have been hobbying for years. Started in old PHP3 early PHP4. So with the newer PHP, things are starting to break!

    I have this string:

    session_is_registered('UserID')

    And I need to convert to this:

    isset($_SESSION['UserID'])

    in more than 200 scripts in my directory. I have been toying with sed (in a copy of the dir of course in case I really screw things over, lol) but am not gettig too far. The new code needs to swap ( ) for [ ] and i'm just all hung up!

    Any help will be hugely appreciated!

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    478
    welcome to the forum

    sed 's/(/[/;s/)/]/' <filename
    the sun is new every day (heraclitus)

Posting Permissions

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