473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Enter data in the middle of a file after doing some pattern matching

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 relog.001 contents before inserting
gpg RC (54321)
Testion Option OK
AIX.SHA1.So


File relog.001 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.
Aug 22 '10 #1
2 1377
numberwhun
3,509 Expert Mod 2GB
You will notice that I deleted your duplicate thread. Please, DO NOT post the same question twice. If you want to post in this same thread and ask if anyone has input, feel free, but please know that the weekends are slow going and an answer may not come till Monday.
Aug 22 '10 #2
RonB
589 Expert Mod 512MB
What part of the process do you not know how to do or is giving you trouble?

Which part of the solutions that you've already been given do you not understand and/or are not working as expected?

Do you understand the solutions that you've been given?

Are you looking for help in troubleshooting, or do you simply want someone to provide you with a complete script that has been tested against your input data?
Aug 23 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dariusz | last post by:
Despite looking at a number of tutorials in books and online examples on pattern matching - I can't quite get my head around it to work... so need some help. What I have now is a variable that...
8
by: gsv2com | last post by:
One of my weaknesses has always been pattern matching. Something I definitely need to study up on and maybe you guys can give me a pointer here. I'm looking to remove all of this code and just...
176
by: Thomas Reichelt | last post by:
Moin, short question: is there any language combining the syntax, flexibility and great programming experience of Python with static typing? Is there a project to add static typing to Python? ...
1
by: Henry | last post by:
I have a table that stores a list of zip codes using a varchar column type, and I need to perform some string prefix pattern matching search. Let's say that I have the columns: 94000-1235 94001...
1
by: kittykat | last post by:
Hi, I want to read the input variables from a user, and then compare this with data in the text file. If the input variables and the data in the text file match, then i would like to create a...
2
by: Joecx | last post by:
Hi If I want to copy files using a pattern like: I want all files on a directory that start with 20050822 to be copied to a different directory. I can't get file.copy or copyfile to accept *.*...
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
2
by: Ole Nielsby | last post by:
First, bear with my xpost. This goes to comp.lang.c++ comp.lang.functional with follow-up to comp.lang.c++ - I want to discuss an aspect of using C++ to implement a functional language, and...
5
by: Mike C# | last post by:
Hi all, quick question. Is there a Windows function I can call to compare a single string like "HELLO.TXT" to a Windows filename/path pattern (possibly with wildcards) like "H?LL?.*" ? Basically...
1
by: VanKha | last post by:
I write this program for pattern-matching,but it gives wrong result: #include<iostream> #include<conio.h> #include<string.h> using namespace std; main() { char text,pat;...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.