?
Solved

Searching for data inside a file

Posted on 1997-11-04
5
Medium Priority
?
132 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 20 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 to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

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

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…
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 strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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 …
Suggested Courses

777 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