rkrish
November 17, 2011, 1:52am
1
I have an input file with contents like:
MainFile.dat:
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
12247689|7896|77698080
16768900|hh78|78959390
I need to split this file in to 10 with each having extension as _temp1,_temp2,_temp3 and so on
and pass each of this file to a 10 processes each to a process:
RemoveUsage File1
RemoveUsage file2
RemoveUsage file3
etc..
Can anyone help me in this
zaxxon
November 17, 2011, 2:06am
2
Each line to a single file? What file names to be used besides the extension? What 10 processes ".. each process"? I do not really understand what you want, sorry. Maybe describe a bit more so that others that do not know what you want to do get a chance to understand to minimize guessing, thanks.
Btw: What have you tried so far?
rkrish
November 17, 2011, 3:38am
3
zaxxon:
Each line to a single file? What file names to be used besides the extension? What 10 processes ".. each process"? I do not really understand what you want, sorry. Maybe describe a bit more so that others that do not know what you want to do get a chance to understand to minimize guessing, thanks.
Btw: What have you tried so far?
The file is 0f about 6000 lines I want to split the file into 10 files so that each file may be having around 600 lines.
The divided files need to be passed as a argument to a tool which takes the input as filename and process it.
RemoveUsage <fileName>
as there are 10 such files I need 10 processess to run parallely with each processing a file.
Try this...
split -b 230 input_file
for file in x*
do
RemoveUsage $file &
done
230 is the size of 10 lines... it is based on the input you have pasted...
--ahamed
rkrish
November 17, 2011, 4:29am
5
The size of the line may vary here...the input file may contain different line sizes..what to do in this case