LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   remove text from file with script (https://www.linuxquestions.org/questions/linux-software-2/remove-text-from-file-with-script-379860/)

paul_mat 11-04-2005 05:47 AM

remove text from file with script
 
hi there,

i've got a text file with a list of email adresses and what i want to do is strip away all the information after the '@'

so turn

user1@example.com
user2@example.com
user3@example.com
user4@example.com

to ..

user1
user2
user3
user4

ilikejam 11-04-2005 05:55 AM

Have another sed one-liner
Code:

sed 's/@.*$//' /path/to/file
Dave

paul_mat 11-16-2005 07:00 PM

hi ilikejam

i got another sed question i thought you might be able to help me out on.

i was wanting to put the output of this into a variable

sed 's/.*: //' /tmp/tmp

do you know how that can be done?

ilikejam 11-17-2005 12:21 PM

Sure.
Code:

MYVARIABLE=`sed 's/.*: //' /tmp/tmp`
Dave


All times are GMT -5. The time now is 08:53 AM.