codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Enter data in the middle of a file after doing some pattern matching  powerfulperl at 12:14 on Sunday, August 22, 2010
 

I Have a file by the name relog.001

I want to search for a line Local=IN
If found then skip

If not found then search for a line starting with 'Testion option Ok'
then insert the line 'Local=IN' after that.

File contents before inserting
gpg RC (54321)
Testion Option OK
AIX.SHA1.So


File contents after inserting
gpg RC (54321)
Testion Option OK
Local=IN
AIX.SHA1.So


Note :- I am passing the Rvalue 'IN' from subroutine, and it can change like (IN or US or

FR) so i need to evaluate it with a regular expression.

lvalue 'Local=Regularexpression'.

Hope it makes sense, quick reply will be appreciated.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  How To write the content in a different file (i.e temp file)and then rename it to the original file name?
•  Enter data in the middle of a file after doing some pattern matching
•  CSS 3.0 Background Properties
•  Sign up to stay abreast on Open source
•  Re: Write text strings to Serial Port
•  Re: Save up to 80% on SSL Certificates, RapidSSL Certificate @ $ 11.00/yr.
•  Re: IsDate() in JavaScript?
•  Re: horizontal scroll bar for drop down list box
•  Sign Up Now!!To Learn Solr Search Development from the Experts


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010