Solved

Searching for data inside a file

Posted on 1997-11-04
5
124 Views
Last Modified: 2013-12-25
I have a script which read user input and append data to file. It is a html file. Now I need a script to search this file and print html page in returns.
The entires are separated by hardlines.
Is there a way to search such a file ?
Jerzy
0
Comment
Question by:jerzyk
  • 3
5 Comments
 
LVL 3

Expert Comment

by:vmpn
ID: 1831068
You cam search anything.  Could you be more specific about the file, that is the only way I might be able to provide you with complete solution.
0
 
LVL 5

Accepted Solution

by:
nathans earned 10 total points
ID: 1831069
Yes you can search it with newline as the seperator..  You first open the file then you read it in line by line.  The default for a each line is the Newline  which is a return character.

If you need help email me
nathan@cyberservices.com  - Home
nathan_stanford@cabp.com  - Work
A True Perl N. u T.
0
 

Expert Comment

by:aurelio
ID: 1831070
That's  right - you can search it in many ways , I think there are at least 3 ways of doing it :
1) Use "grep" , it returns lines matching a word or a regular expression.
2) Use a shell script reading line by line , better a perl script
3) Use in C something like
while(fgets(buf,80,fp)!=NULL) if(strcmp(match,buf)) do_something() ;

0
 
LVL 5

Expert Comment

by:nathans
ID: 1831071
I want to help it makes me a better programmer please send me a copy or a file with simular data with the info changed and I will make a script to fix the problem.
0
 
LVL 5

Expert Comment

by:nathans
ID: 1831072
I want to help it makes me a better programmer please send me a copy or a file with simular data with the info changed and I will make a script to fix the problem.

If you need help email me
nathan@cyberservices.com - Home
nathan_stanford@cabp.com - Work
A True Perl N. u T.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now