Afficher un message
Vieux 19/08/2006, 15h50   #4
Michal Nazarewicz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Read and delete one line from file

chlori (usenet314+arto.ch) writes:

> - File One gets lines added to it every few minutes.
> - A shell script should copy the first line into File Two and so on
> until File Two has 100 lines.
> - Then File Three is created and the same is done there.


You cold use named pipe (man mkfifo):

$ mkfifo sh17

then configure the app (or whatever) to write lines to that pipe and
finally your shell script would look like:

NUM=0
while NFS= read LINE; do
read
printf '%s\n' "$LINE" >file-$(($NUM / 100))
NUM=$(($NUM + 1))
done <sh17

or something similar. I hope you got the idea.


--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
  Réponse avec citation
 
Page generated in 0,05094 seconds with 9 queries