Le Tue, 8 Mar 2005 06:44:27 +0000 (GMT), Philip Rowlands disait : > On Mon, 7 Mar 2005, Olivier Delhomme wrote: > > >I have a specific problem with a file that i want to split : > >I would like to split the file in 'x' pieces for exemple. But i would > >like to have line one in file one, line two in file two and so on then > >line x in file x and line x+1 in file one ... > > sed -ne '1~2p' < input > oddlines > sed -ne '2~2p' < input > evenlines
Thanks a lot, this is exactly what I was looking for ! I didn't expected that sed would do the job ! what I want can be done like this : where nbp == 'x' pieces and file == the file I want to split nbp=8; file=myfile.to.split; for i in $(seq 1 $nbp); do echo -n "$i~$nbp" >script.file; echo "p" >>script.file; cat $file | sed -nf script.file >$file.piece.$i done; > Cheers, > Phil Thanks again, this will save much time, Cheers, Olivier.
pgpkF25QrCMQC.pgp
Description: PGP signature
_______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
