- 
	
	
		
			
			
				Expert Member
			
			
			
			
				
					
						
					
				
			
			 
			
				
				
				
				
				
					    
				
			
		 
		
			
				
				
				
					SPLIT command
				
				
						
							
							
						
						
				
					
						
							Hi All 
I have a file that has over 5,00,000 records and I want to split the file into 65,500 rows. 
I am able to split the file into 7 files using SPLIT command. I want to know if it is possible to attach a header for all the 7 files using a single script or a single command along with the SPLIT command. Help would be very much appreciated.
Thanks 
Sharath
						
					 
					
				 
			 
			
			
		 
	 
		
	
 
                                             
- 
	
	
		
			
			
				Junior Member
			
			
			
			
				
					
						
					
				
			
			 
			
				
				
				
				
				
					    
				
			
		 
		
			
				
				
				
					Re: SPLIT command
				
				
						
						
							
						
				
					
						
							you can use -lnumber to tell split how many rows (or record if a row is a record)  will be each file.
split -l65000 mi_huge_file_500000 
after that split will create the files xaa, .... etc...
if you want to put a header on each file create the header file and later do a cat on the following way:
cat xaa >> header_file
will append xaa to the header file, but becareful if you want to use the same header, you must replicate it, so you don't lose it.
En fin... try with a script something more elaborated...
I recommend you the advanced bash scripting guide
http://www.tldp.org/LDP/abs/abs-guide.pdf
HTH
						
					 
					
				 
			 
			
			
		 
	 
		
	
 
                                             
		
		
		
	
 
	
	
	
	
	
	
	
	
	
	
	
	
		
		
			
				
				Posting Permissions
			
			
				
	
		- You may not post new threads
 
		- You may not post replies
 
		- You may not post attachments
 
		- You may not edit your posts
 
		-  
 
	
	
	Forum Rules