Split

Hello people,
I have a huge file of say 1 gb called A123.txt..

to get the word count, i do

 
wc -l A123.txt
 

This gives me a count of say 122898.
Now what i do is, i divide this by 4 ie. 122888/4=30722
Now i copy the content as per the above count (30722) and give some name to each of the 4 files, since the size is too huge...

How can i do this with some script.

Hi,

which script do you need perl??

Cheers,
Ranga:)

No need for Perl,

man split

yes, we can with split.

split -l 5000 inputfile outputfile

split input file into 5000 line
also split by byte with -b option

Cheers,
Ranga:)

no no i dont need perl script, unix script is ok......

What i need is to automate the process...
like
1.The script will read the wc -l count and then divide it into 4 and then according to the division it will name the files accordingly.

Hi,

Then you can use split function to split file into pieces.
please refer man split.

Cheers,
Ranga:)

I tried but unable to do it..

---------- Post updated at 01:13 PM ---------- Previous update was at 10:58 AM ----------

Done...many thanks...