Sorting part of a large text file...

Discussion in 'Mac Apps and Mac App Store' started by shinji, Mar 26, 2008.

  1. shinji macrumors 65816

    shinji

    Joined:
    Mar 18, 2007
    #1
    I have a 24 mb text file and I need to create another one that contains all the lines with a given keyword.

    Is there a simple unix command to do this? Or am I better opening the whole thing in textmate and trying it that way?
     
  2. CanadaRAM macrumors G5

    CanadaRAM

    Joined:
    Oct 11, 2004
    Location:
    On the Left Coast - Victoria BC Canada
    #2
    BBEdit is probably the best application for this.

    However, Excel is also a useful tool for text manipulation. (however, you are limited to working with chunks of the file that are no more than 65,000 lines long)
     
  3. shinji thread starter macrumors 65816

    shinji

    Joined:
    Mar 18, 2007
    #3
    I've actually been thinking about switching to BBEdit despite the silly pref pane.

    Got another thread about that here: http://forums.macrumors.com/showthread.php?t=460512

    But as far as this issue, there must be some way built-into the os? I'm not even sure how to search the man pages for this because it's such a broad topic and there so many commands.
     
  4. shinji thread starter macrumors 65816

    shinji

    Joined:
    Mar 18, 2007
    #4
    Actually I just figured this out

    grep -i "keyword" filename.txt > newfilename.txt
     

Share This Page