Suhas
Suhas

Reputation: 131

How to open a large sql script (22GB!) in ubuntu?

I have a sql script which makes tables and adds data but the file is very huge, 22GB!! I'm unable to open it in gedit/vim with LargeFile/chrome. Nothing seems to be working.

Upvotes: 0

Views: 744

Answers (1)

meucaa
meucaa

Reputation: 1515

As mentioned here:

Another method is to use split. Split the file into n pieces and manipulate the files with a editor. After that, you reassemble the files again.

split -b <size of a part> <your-file>

cat xa* > <your-file>


SYNOPSIS
   split [OPTION]... [INPUT [PREFIX]]

   -a, --suffix-length=N
          use suffixes of length N (default 2)

   -b, --bytes=SIZE
          put SIZE bytes per output file

   -C, --line-bytes=SIZE
          put at most SIZE bytes of lines per output file

   -d, --numeric-suffixes
          use numeric suffixes instead of alphabetic

   -l, --lines=NUMBER
          put NUMBER lines per output file

Upvotes: 1

Related Questions