473,400 Members | 2,145 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,400 software developers and data experts.

To search for text in file and then returns the two lines following it

1
Hoping someone can help on this one. Have got some great information here.

I need to search a text for for the string "Read {"

When found I then need to return the two line following it.

So...... text is
Read {
inputs 0
file Q:/path/path/file.png

I can find the string "Read {"
but not sure how to return the two lines aftetr it.
Actually want I want is the file path but only as they apply to "Reads" not other things in the file.



file Q:/path/path/file.png
Oct 31 '11 #1
3 1439
bvdet
2,851 Expert Mod 2GB
Iterate on the file object: for line in fileObj:

If the target text is in line, return the next 2 lines:
Expand|Select|Wrap|Line Numbers
  1. return fileObject.readline(), fileObject.readline()
Oct 31 '11 #2
i didn't get please reply once again.
Nov 2 '11 #3
bvdet
2,851 Expert Mod 2GB
srikanthtullimi,

What is it you did not get?
Nov 2 '11 #4

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

Similar topics

10
by: Yogi_Bear_79 | last post by:
pardon my ignorance as I am a self-taught hobbyist programmer. I am curious after reading up on SharpZipLib. Can I embed a zipped txt file in my program? Then either read from within the zip...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
1
by: JenHu | last post by:
Hi all, I want to create a text file to write lines, but it gives me an error on Dim sw As New StreamWriter(CreatePath & Efilename) : System.IO.IOException: The process cannot access the file...
0
by: Darin | last post by:
I have a comma-delimited text file that I am reading via a connection string: junk = "Provider=Microsoft.Jet.OLEDB.4.0;" junk &= "Data Source=\inware\data\df;" junk &= "Extended...
4
by: anne001 | last post by:
Hi For a class, students are going to run an experiment on line. Each time a subject runs, his/her data is appended to one giant text file. Their own data set will be just one line starting with...
4
by: Alessandro | last post by:
Hi everybody, I tried to find some information about my subject with google, but I didn't find anything. I need to read a text file, process the entire content, then kill. In the meantime I...
6
by: thorpk | last post by:
I have an access database that i have added a pop up calendar to, the Table information for the Date Reported field is Date/Time format short date, input mask is 00/00/0000. i have created a...
0
by: fh217 | last post by:
Hi, Is there a way in Access to retrieve data in a specific area of a text file? The data ( a 6 character date in YYMMDD format ) always resides on the second line in positions 11 to 16. Thank...
1
by: ogo796 | last post by:
Hi everyone i want to search the text file,using pregmatch() but it seems like it dose't serch.maybe my serching pattern is not right.look at the following code. Myfile look like this...
4
by: nxstar | last post by:
Hi I am confused about how to go about writing this program in perl. I have a text file with data in columns 8 and 9. I need to extract the data value from column 8 from the line being read and...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.