Posts Tagged ‘new’

Using sed to remove lines

So you have the following list of email addresses in the syntax and you want to strip out everything after the @ sign leaving you will a list of usernames. The user names need then to be on one line only.

So for example if the file called “email_list” looked like this:

To get the first part working:

# cat email_list | sed ‘s/@.*//’

Meaning everything after the @ replace with nothing.

You will get a list like this:


….but we want the output all on one line to be able to copy and paste it:

# echo $(cat email | sed ‘s/@.*//’)

Now you get:

test1 test2 test3

Flight Of The Conchords

Had this programme recommended to me, havent had a chance to watch the series yet but from what ive seen on youtube its frickin hilarious.

Extract from wikipedia:

Flight of the Conchords is a Grammy Award-winning New Zealand comedy duo composed of Bret McKenzie and Jemaine Clement. Billing themselves as “Formerly New Zealand’s fourth most popular guitar-based digi-bongo acapella-rap-funk-comedy folk duo”, the group uses a combination of witty observation, characterisation and acoustic folk guitars to work the audience.