The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to find a specific files in a many directory selamba_warrior Shell Programming and Scripting 7 05-28-2008 03:41 PM
deleting specific lines from all files in a directory vrms UNIX for Dummies Questions & Answers 3 04-25-2008 11:08 AM
List all files that contain a specific directory Sat510 SUN Solaris 7 04-17-2007 10:57 AM
delete files in specific directory legato Shell Programming and Scripting 2 03-29-2006 09:46 PM
creating object files in a specific directory svh High Level Programming 1 02-13-2006 06:05 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 2 Weeks Ago
amcrisan amcrisan is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 8
Splitting files into a specific directory

Hello,

I am trying to do the following;
bzcat data.in.bz2 | split -l 1000000 -d

this work great, except that once the files have been split, they are not in the directory I want them to be in. So I then have to move them, at times this can get hairy.

Is there anyway to specify where the files go after using the split command?

Thanks,
  #2 (permalink)  
Old 2 Weeks Ago
scottn scottn is offline Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,042
Try
Code:
bzcat data.in.bz2 | (cd whereever; split -l 1000000 -d)
Or
Code:
cd whereever
bzcat /path_to_my_bzfile/data.in.bz2 | split -l 1000000 -d
  #3 (permalink)  
Old 2 Weeks Ago
amcrisan amcrisan is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 8
Is there anyway that the files outputted couldn't have the x00 format and instead make it have a more meaningful name? Or is the mv command also required for that?

Thanks though, the directory idea worked.
  #4 (permalink)  
Old 2 Weeks Ago
scottn scottn is offline Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,042
Check the man page for split, you can vary it somewhat.

If you have a degree in quantum physics you could challenge csplit.
  #5 (permalink)  
Old 2 Weeks Ago
amcrisan amcrisan is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 8
it turns out that - is the secret... I had no idea what the man page was talking about with that dash, but doing this

bzcat $datadir/FILE.bz2 | split -l num -d - $outputdir/FILE_NAME

will put it in the directory and with the name.

Thanks for all the help : )
Bits Awarded / Charged to amcrisan for this Post
Date User Comment Amount
2 Weeks Ago scottn that - always gets me! 1,000
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0