Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split & Cat 1

Status
Not open for further replies.

jayjaybigs

IS-IT--Management
Jan 12, 2005
191
CA
The idea is to do the following:

(1)Split one big file into several smaller files of equal sizes
(2)Perform operation on the smaller sizes
(3)Join the smaller files into a big file
(4)Remove all the smaller files created in (1).

Here are the efforts:

#!/bin/sh

#split big file

split bigfile outfile

#Perfom Operation on each file - change space to comma within each file

cat outfile* | %s/ /,/g

#join smaller files
cat outfile* > bigfile_result

#Remove all smaller files.

rm outfile*

This does not work, please advice.
 
Why not simply this ?
sed 's! !,!g' bigfile > bigfile_result

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The idea of splitting or cspliting is to reduce the time to generate the outpufile. The bigfile has over 12 milion records.
 
If performance is an issue:
tr ' ' ',' < bigfile > bigfile_result

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top