GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   linux gurus (https://gfy.com/showthread.php?t=898032)

Hustlin Entertainment 04-05-2009 10:05 PM

linux gurus
 
hey..i have a question for all you linux gurus out there..i have a small list of usernames and passwords..i want to extract the usernames only and put them into a seperate text file

the file looks like this

[email protected]:password
[email protected]:password2

i want to extract the #@test.com's,...how can i do this...im not new to linux just haven't used it in awhile :helpme

thanks

Angry Jew Cat - Banned for Life 04-05-2009 10:10 PM

write a quick perl script that'll extract all the emails. can't remember the name of the module that extracts emails of the top of my head. but if you search cpan you should find it easily enough. a little goolging should turn up smple code that'll perform the task. seems like a pretty common task to perform.

try this

perl -wne'while(/[\w\.]+@[\w\.]+/g){print "$&\n"}' test.txt

Hustlin Entertainment 04-05-2009 10:13 PM

well i think i found something with grep, i don't think i even got perl installed on this box it'd be too much hassle, i'll post back with my results soon enough....

Hustlin Entertainment 04-05-2009 10:55 PM

cut -d ':' -f 1 accounts.txt > accounts2.txt

easiest way i've found....

:pimp

mikesouth 04-05-2009 11:50 PM

Quote:

Originally Posted by Hustlin Entertainment (Post 15711086)
cut -d ':' -f 1 accounts.txt > accounts2.txt

easiest way i've found....

:pimp

yup thats the right way to do it.

mikesouth 04-05-2009 11:53 PM

Quote:

Originally Posted by Hustlin Entertainment (Post 15711086)
cut -d ':' -f 1 accounts.txt > accounts2.txt

easiest way i've found....

:pimp

yup thats the right way to do it. cept you should probably use >> accounts2.txt lest you overwrite it every line dont remember how cut parses for that but >> would work either way long as ya dont run it more than once


All times are GMT -7. The time now is 10:21 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123