Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009
    Posts
    56

    Unanswered: how to open the . Dat file based on pattern in vi editor

    Hello Friends ,

    I have 7 GB of .dat file and I cannot open in vi editor as its very huge .

    I know that there are few records in my .dat file that needs my criteria .

    Can any one tell how to open a .dat file now based on match or create a new file based on search pattern say "1235188673" so that I can have a file with required data that I need to validate .

    Thanks in advance .

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Based on your idea of using vi, I'll assume that the file contains text. To extract lines of text in *nix, I'd use grep or gawk.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Use 'split' to create a number of small files, then edit those, and put the small files back together again.
    Code:
    mkdir temp
    cd temp
    split -l 100000 ../big_file
    vi *
    cat * >../new_big_file
    Depending on the length of the records, you may want to adjust the number of lines in each file.

Posting Permissions

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