Find the answer to your Linux question:
Results 1 to 3 of 3

Thread: grep first word

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    grep first word


    I have a file like this:

    user1 helloblabla
    user2 blauser1bla
    I need to grep user1 but Only the line where user1 is the first word. How do I do this?

    If I run "grep user1 file.txt" it will grep both lines..

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    egrep '^user1' file.txt
    You must always face the curtain with a bow.

  3. #3
    Wow that was fast!

    Thanks a lot, it works perfectly!

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts