Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-05-2009, 10:10 PM   #1
LQ Newbie
Registered: Dec 2008
Posts: 5

Rep: Reputation: Disabled
How to remove everything before the first space in Sed or Awk

Hi, I have a list of names and numbers that looks like this:

john doe - 5551236565
jane doe - 5559875656

Now, obviously, the first names are different lengths, as are the last names. I need to know how to remove all the characters in each line up until the first space so that the output looks like this:

doe - 5551236565
doe - 5559875656

Old 04-05-2009, 11:45 PM   #2
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
sed 's/[^ ]* //' file.txt


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SED/AWK help bioinformatics_guy Linux - Newbie 1 08-12-2008 06:07 AM
awk or sed help cmontr Programming 16 05-14-2008 11:59 AM
SED, regexp or such - remove text after space aolong Linux - General 5 03-07-2008 03:36 PM
bash/sed/awk fill each line in text file with space to fixed length khairil Programming 11 01-09-2008 06:28 AM
awk and/or sed linux2man Linux - General 7 01-22-2007 11:02 AM

All times are GMT -5. The time now is 04:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration