Solved

Searching for data inside a file

Posted on 1997-11-04
5
125 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help deploying an MSI via silent install using PSEXEC 4 61
Update a File not in all folders 2 43
Disk Ram Peak 1 33
Recursively Delete Files 5 68
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

867 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

24 Experts available now in Live!

Get 1:1 Help Now