LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to remove everything before the first space in Sed or Awk (https://www.linuxquestions.org/questions/linux-general-1/how-to-remove-everything-before-the-first-space-in-sed-or-awk-717059/)

OutThere 04-05-2009 09:10 PM

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

Thanks.

Berhanie 04-05-2009 10:45 PM

Code:

sed 's/[^ ]* //' file.txt


All times are GMT -5. The time now is 01:19 PM.