Yes, sorry. I was using GNU extensions to the split command, which is why I mentioned the OS I tested it on. Had I known you are on AIX I would never have suggested it.
Quote:
Also a minor change.
I need to Run the split command in a script with numer of lines to split as parameter1 and input file name as parameter2 additionally the script should reside is some other directory other than the current or working directory as I will end up deleting the working/current directory after picking up the splitted files.
The split filenames should have 3 digit prefix and the input file name example : 001_abc.txt, 002_abc.txt e.t.c
Thanks
So depending on whether you are writing this script for yourself or multiple users the script should be placed in $HOME/bin or /usr/local/bin and your profile file (the one that is run at login) should ensure that directory is in your path ($PATH for sh, ksh or bash; $path for csh).
You can use $1 and $2 for your parameters but reassigning them gives them meaning.
Assuming you have the -a suffix_length opton to split:
Then use RudiC's solution (replacing abc.txt with ${fname}.
I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this.
For example:
split -l 3000000 filename.txt
This is very slow and it splits the file with 3 million records in each... (10 Replies)
Hi All,
I have a requirement .I want to split a file and the split files should have certain names.
Currently when i use the split command
split -1000 testdata testdata_
Then the output is
testdata_aa
testdata_bb
testdata_cc
and so on.
But i want the output as
testdata1.snd... (3 Replies)
I have a file test1.html like below:
<dctm_topnav_en_US>
<html>
.....
</html>
<dctm_topnav_en_CA>
<html>
.....
</html>
<dctm_topnav_en_FR>
<html>
.....
</html>
I need to use awk to split this into three file names like en_US.html ,
en_CA.html, en_FR.html each having content between... (4 Replies)
Hi everyone,
I am trying to write an if statement that will split a file if it is over 1 million records/lines into files with say 900,000 records and then rename
those files without the aaa, aab, aac format that splitting normally does and into a specific naming convention. For instance, if... (2 Replies)
I have a file named Me_thread_spell.txt that I want to split into smaller files. I want it to be split in each place there is a ;;;. For example,
blah blah blah ;;;
blah bhlah hlabl
awasnceuir
asenduhfoijhacseiodnbfxasd;;;
oabwcuhaweoir;;;
This full file would be three separate files... (7 Replies)
Hello;
I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Hi,
I have a data file like below
messageid|email|timestamp
750452173|123@googlemail.com|2013-05-24 16:14:32
750464921|000@gmail.com|2013-06-13 19:38:01
750385426|001@googlemail.com|2013-01-06 12:06:36
750373470|000@wz.eu|2012-11-30 22:32:07
.
.
I want to split the files based on the... (4 Replies)
Hello,
Need to split files into n number of files and rename the files
Example:
Input:
transaction.txt.1aa
transaction.txt.1ab
......
Output:
transaction.txt.1
transaction.txt.2
transaction.txt.3 (3 Replies)
Hello,
I'm using Windows 7 ; sed, awk and gnuwin32 are installed.
I have a big text file I need to manipulate.
In short, I will have to split it in thousands of short files, then rename and save in a folder which name is based upon filename.
Here is a snippet of my big input.txt file (this... (4 Replies)
i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies
LEARN ABOUT DEBIAN
mpb-split
MPB(1) MIT Photonic-Bands Package MPB(1)NAME
mpb-split - compute eigenmodes with MPB using multiple processes
SYNOPSIS
mpb-split NUM-SPLIT [DEFINITION]... [CTLFILE]...
DESCRIPTION
mpb-split is a parallelizing front-end to MIT Photonic Bands (MPB). For a computation with several k points, it splits the list of k
points over multiple processes. Of course, this will only benefit you on a system where different processes will run on different proces-
sors, such as an SMP or a cluster with automatic process migration (e.g. MOSIX). mpb-split is actually a trivial shell script, though, so
you can easily modify it if you need to use a special command to launch processes on other processors/machines.
MIT Photonic Bands (MPB) is a free program to compute the band structures (dispersion relations) and electromagnetic modes of periodic
dielectric structures, and is applicable both to photonic crystals (photonic band-gap materials) and a wide range of other optical prob-
lems.
More information on MPB, including a detailed manual, can be found online at the MPB home page: http://ab-initio.mit.edu/mpb/
A typical invocation of mpb-split looks like:
mpb-split num-split foo.ctl >& foo.out
This causes mpb-split to process the control file foo.ctl, divide the k points into num-split equal chunks, run each list in a separate
process with MPB, and redirect the output (in order) to foo.out. (One typically redirects output to a file, as the output is verbose and
contains a number of comma-delimited datasets that one can extract by grepping.)
Overall, the behavior and arguments are the same as for mpb except that the first argument must be the integer num-split.
What mpb-split technically does is to set the MPB variable k-split-num to num-split and k-split-index to the index (starting with 0) of the
chunk for each process. If you want, you can use these variables to divide the problem in some other way and then reset them to 1 and 0,
respectively.
BUGS
Send bug reports to S. G. Johnson, stevenj@alum.mit.edu.
AUTHORS
Written by Steven G. Johnson. Copyright (c) 1999, 2000, 2001, 2002 by the Massachusetts Institute of Technology.
SEE ALSO mpb(1), mpb-data(1)MPB March 13, 2002 MPB(1)