Jump to content

using calculations in scripts

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
kvok

kvok

    Newbie

  • Members
  • Pip
  • 1 posts
HI

I have the following problem.
I need to use split command to split files. Each should be cca 700 lines but i don't know how to implement it in the scripts because each time the original file will be various sizes.
anybody have any idea

cheers

Edited by xXHalfSliceXx, 28 July 2009 - 03:24 PM.


#2
DarkLordoftheMonkeys

DarkLordoftheMonkeys

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
I suggest you learn sed. sed will allow you to split files vary easily.

For example:


$ sed "700q" textfile > first700lines.txt

$ sed "1,700d; 1400q" textfile > next700lines.txt


Life's too short to be cool. Be a nerd.