Solved

Searching for data inside a file

Posted on 1997-11-04
5
129 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

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 …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to count occurrences of each item in an array.
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…

707 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