in reply to Search and Replace line by line not working on Filehandle

What's
$_ "\#\ SQLNET\.AUTHENTICATION_SERVICES=\ (NTS)"
suppose to do? Are you missing a comma?

Replies are listed 'Best First'.
Re^2: substitute on file line by line not working syntax error
by matze77 (Friar) on Jan 15, 2010 at 08:47 UTC
    changed this the comma was missing:
    print OUT $_ , "\#\ SQLNET\.AUTHENTICATION_SERVICES=\ (NTS)";
    OK. Now the line prints, i wanted it to overwrite the original line but it prints to the next line maybe i need to "remember" the line number and overwrite it?
    result:
    SQLNET.AUTHENTICATION_SERVICES= (NTS) 1# SQLNET.AUTHENTICATION_SERVICES= (NTS)<p>
    Are the parentheses around (NTS) interpreted as "backreference" and printed before as 1 ...?

    Thanks
    MH
      If you want just the new line, not the old and the new one, don't print the old one ($_).
        Ah ok. Thanks. Thats one fault (recycled old code without thinking first). But it prints a line **after** the line that should be changed, i want to **overwrite** the line not "append". Any idea? Something like moving the "Write Pointer" back 1 line and write it there?


        Thanks
        MH
Re^2: substitute on file line by line not working syntax error
by matze77 (Friar) on Jan 15, 2010 at 08:41 UTC
    original file:
    # SQLNET.ORA Network Configuration File: c:\oracle\ora81\network\admin +\sqlnet.ora # Generated by Oracle configuration tools. NAMES.DEFAULT_DOMAIN = world SQLNET.AUTHENTICATION_SERVICES= (NTS) NAMES.DIRECTORY_PATH= (TNSNAMES) SQLNET.AUTHENTICATION_SERVICES= (NTS)<p>
    The Line SQLNET.AUTHENTICATION_SERVICES= (NTS) needs to be commented/deactived so afterwards it reads:
    # Generated by Oracle configuration tools. ... # SQLNET.AUTHENTICATION_SERVICES= (NTS) ...

    <id://>

    Thanks
    MH