User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Text file help... Page [1]  
ddlakhan
All American
990 Posts
user info
edit post

So imagine if you have a text file that has strings of emails on it descending down the page. I want to delete everything before the @ but leave everythin after it. is there a quick way to do this? aside from manually clicking each one?

11/12/2006 9:44:35 AM

goFigure
All American
1583 Posts
user info
edit post

perl script... EXTREMELY easy

regular expression matching...

if I wasn't hungover with a headache I'd do it for you...

or you can copy and paste it into excel and then have the text import editor delimit on the @ sign





[Edited on November 12, 2006 at 9:58 AM. Reason : or excel]

11/12/2006 9:55:41 AM

ddlakhan
All American
990 Posts
user info
edit post

I am gonna have to try the excel path... delimit.. i kinda get what your saying, but any other useful details would be nice.

thanks for the help

11/12/2006 10:01:38 AM

goFigure
All American
1583 Posts
user info
edit post

it'll work... too hungover to hold a coherant lecture

11/12/2006 10:04:19 AM

qntmfred
retired
40726 Posts
user info
edit post

you could also use a formula

if A1 contains the email, then paste this in B1

=RIGHT(A1,SEARCH("@",A1)-1)

11/12/2006 10:09:31 AM

Excoriator
Suspended
10214 Posts
user info
edit post

if its in unix, you can run the following command:

cat file.txt | sed 's:@: :g' | awk '{print $2}' > new_file.txt


And yes, I know you don't have to cat it first, I just like to.

11/12/2006 10:23:51 AM

goFigure
All American
1583 Posts
user info
edit post

ok this thread needs clarification...

are you trying to get the complete email addresses? or just the @gmail part to see where people are signed up?

11/12/2006 10:26:13 AM

ddlakhan
All American
990 Posts
user info
edit post

basically i put all this time and effort to try and block all these emails from spammers. now ive realized, quite late in the game that they just change a few letters on the senders name and get through. so i was hoping to cast a wider net with hte domain names. I am gonna try the excel trick when i get the chance. But to answer your question yes... @gmail.com is the kinda the format i need/want.

11/12/2006 10:38:41 AM

ddlakhan
All American
990 Posts
user info
edit post

i dont konw if something is wrong with the string =RIGHT(A1,SEARCH("@",A1)-1) but i tried this.. it gives me a blank in B1.

11/12/2006 10:40:36 AM

Excoriator
Suspended
10214 Posts
user info
edit post

cat file.txt | sed 's:@: :g' | awk '{print "@" $2}' > new_file.txt

11/12/2006 10:51:46 AM

 Message Boards » Tech Talk » Text file help... Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.