Membership is FREE, giving all registered users unlimited access to every DNForum feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Big list of data extract? How?

Status
Not open for further replies.
T

tekz999

Guest
Lets say I have a list like this:

apple
banana
cat
dog

I want to extract all lines with "a", so result is like this:
apple
banana
cat

Any idea how? Thanks!
 

Luc

Old school
Legacy Exclusive Member
Joined
Jul 18, 2002
Messages
1,574
Reaction score
5
Do you have linux server?

if so, very easy...

cat INPUTFILE | grep -i "a" > OUTPUTFILE

will output to OUTFILE all lines that contain "a"
 
T

tekz999

Guest
Please windows, preferably an addon in DRT or a fast make php script ;)
 

Luc

Old school
Legacy Exclusive Member
Joined
Jul 18, 2002
Messages
1,574
Reaction score
5
sorry man, for big lists PHP will fail due to execution timeout, or memory usage.

if you need processing now, you can send list, i can process and send back. PM me for email address.
 

Johnn

Level 14
Legacy Exclusive Member
Joined
Apr 13, 2004
Messages
15,995
Reaction score
1,419
Just ftp the file to your linux webserver and run the command.
 
T

tekz999

Guest
Thanks luc! But I really need to do this myself ;)

I remember I can put a list of words within an area in the php file, then input the letter/word I am looking for in another area, then it will run, and auto-save it as a new file, then I simply login to FTP and download the newest file.
 

Luc

Old school
Legacy Exclusive Member
Joined
Jul 18, 2002
Messages
1,574
Reaction score
5
well. if you have file on server, you can run this command from php...

PHP:
<?php

exec('cat INPUTFILE | grep -i "a" > OUTPUTFILE');

?>

there are a million ways to do it, but i am too lazy to write the php code, it's best to execute from server. good luck!
 
T

tekz999

Guest
It worked @.@
Thanks for the great help Luc!

How do I make it run and capitalize the first letter after a "space"?

e.g.
apple orange

becomes:
apple Orange

Thanks!
 

Luc

Old school
Legacy Exclusive Member
Joined
Jul 18, 2002
Messages
1,574
Reaction score
5
in the php file, the exec should have this..

exec('cat INFILE | grep -i "a" | sed "s/ [a-zA-z]/\U&/gi" > OUTFILE');
 
Status
Not open for further replies.

Who has viewed this thread (Total: 1) View details

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members Online

Premium Members

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators

Top Bottom