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

php script for taking text

123 100+
Hi ,
i have one file , which contains the result of one field from the database table.
look like this,
+---------------+
| email |
+---------------+
| |
| |
| |
| |
| abc@example.com |
| ddd@example.com
ppp@example.com |
+---------------+

i want to write a script which can give me results like,


abc@example.com
ddd@example.com
ppp@example.com..

I used sed command ,but not worked...
May 9 '08 #1
6 1291
Markus
6,050 Expert 4TB
No idea.

Show the code you're using now, and we can help from there.
May 9 '08 #2
ajd335
123 100+
Hi..My file is like below :

+------------------+
| email |
+------------------+
| |
| |
| |
| |
| abc@example.com |
| email |
| |
| |
| |
| |
| abc@example.com |
| ajan@example.com |
| ha@example.com |
| abcd@example.com |
| web@example.com |






is the table..that is in one text file..
I just want to have all the email address..

Expand|Select|Wrap|Line Numbers
  1. sed -n "/com/p"  result.txt > result.csv  
  2.  
and it gives me

| abc @example.com|
| bbb@example.com |

something like this..
m missing something to avoid that extra |..
plz help..
Thanks
May 9 '08 #3
Markus
6,050 Expert 4TB
No.
I mean the code you use to produce that file.
i.e. the php
<?php ... ?> that stuff
May 9 '08 #4
ajd335
123 100+
No.
I mean the code you use to produce that file.
i.e. the php
<?php ... ?> that stuff

Hi mark,
No, it's like i have one php file in which user enters certain things , Then using PHP script all data goes to the databse , From that table i need email field.

N that is the result.txt file in which i am storing the results from the Select query..

Hope i make things clear..
May 9 '08 #5
coolsti
310 100+
Perhaps you can explain to us why you seem to extract the data from the database to this text file, and then wish to parse the text file to get the email addresses?

PHP can certainly read your text file and extract the email addresses with the proper scripting, without needing to "leave PHP" to execute the shell command sed. However, it seems to me it would be more efficient and easier to program in the long run if you extracted the email addresses from the database directly with PHP, and not create this text file as middle man.
May 9 '08 #6
TheServant
1,168 Expert 1GB
Hi mark,
No, it's like i have one php file in which user enters certain things , Then using PHP script all data goes to the databse , From that table i need email field.

N that is the result.txt file in which i am storing the results from the Select query..

Hope i make things clear..

Hi ajd335,
The one php file you mentioned, we want that code. The output is of little use, and we do not taylor make code, rather fix code that has already been made and is not working as expected. Hope that helps.
May 11 '08 #7

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

Similar topics

10
by: Don | last post by:
I want the server-side php script to return a browser page that is essentially a copy of the original client page that contained the <form> which referenced the php script in the first place....
13
by: Ideasman | last post by:
Hi I have a made a script that process normals for a flat shaded 3D mesh's. It compares every vert with every other vert to look for verts that can share normals and It takes ages. I'm not...
5
by: Rajani | last post by:
Hello, First of all sorry for the long code. But i want to explain clearly what i am doing. For i = 0 To UBound(arrResSizes) - 1 For j = 0 To UBound(arrqty) - 1 For k = 1 To totopr Step 8...
2
by: michael solis | last post by:
When I open a web page with the following script the "CLfolder.JPG" file is supposed to show. For some reason I only see the image place holder. How can I get the CLfolder.JPG to show after the...
44
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
1
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select...
17
by: PJ | last post by:
Greetings... I have stumbled upon a small problem. I use Ajax to retrieve part of a page I need to update. I update a DIV element with the HTML contents I get from another page. It works...
2
by: HopfZ | last post by:
Is there a way to make a (cross-browser) javascript function that will open an existing webpage (for example, www.google.com) in a new window (or in some part of _self) and then load a specified...
1
by: andre.labonte | last post by:
Hi! I have a script that is taking some time to run and in my page, i've placed some comments to be displayed on the webpage so I can know what the script is currently running. Unfortunately,...
24
by: owz2008 | last post by:
This has probably been covered before but could not find a similar thread. Basically I have created a form which can be viewed at www.icomworks.co.uk/canvaspayform.html I want to submit the...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.