View Single Post

  #3 (permalink)  
Old 10-29-2007, 11:55 PM
vikas027 vikas027 is offline
Member
User
 
Join Date: Oct 2007
My distro: Linux RHEL 5
Posts: 33
Rep Power: 0
vikas027 is on a distinguished road
Default

Quote:
Originally Posted by nixcraft View Post
I'm not sure if I understood your problem, can you explain it little bit..

Hi,

Well I am explaining it again.
I have a file say final.txt, which has some data in it.

For e.g.
Quote:
final.txt

SERVER
w
easf
fwsfw
fsdf
23

SERVER
wefwrg
234gf
dfgh32
fdfg3r
gdfg34
grer3467
322rfgt45

SERVER
3211
33
453de
43ffg
Now, I need to split this file, by matching a string SERVER such than I have three files list1, list2, list3.

As in this case, it may be:

Quote:
File list1
SERVER
w
easf
fwsfw
fsdf
23

File list2
SERVER
wefwrg
234gf
dfgh32
fdfg3r
gdfg34
grer3467
322rfgt45

File list3
SERVER
3211
33
453de
43ffg
Now, I know the command to split this file final.txt i.e.
awk '/SERVER/{n++}{print > f n}' f=/vikas/list /vikas/final

But the problem I am facing is that my actual file final.txt is pretty big, which needs to splitted into around 30 files, which is however not being possible by this command, as it can only split upto 10 files at max only.

Hope I have made my point clear.

Thanks.
Reply With Quote