1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Rep Power

    Displaying specific lines using grep

    Display all lines that have only 4, 5, 6, 7 and 9 in the zip code. The file is in columns. Im trying to use grep. Can anyone give me the correct syntax?

  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Rep Power
    Is there anything else on the line apart from zip codes, like say house numbers ?

    1600 Pennsylvania Ave NW, Washington, D.C., DC 20500, United States
    This line has a 6, but it isn't in the zip code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Rep Power
    I suspect that awk would be better fo this, using a regex (~) on the column in question.
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo