Afficher un message
Vieux 20/08/2006, 00h13   #6
Loki Harfagr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Read and delete one line from file

Le Thu, 17 Aug 2006 16:54:53 +0200, chlori a écrit:

> Hello
>
> I have a shell scripting (bash) problem:
>
> - 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.
>
> Any ideas how I could do that?


How could you do what ?
Wouldn't it be easier to post the exact text of this homework ?
Just because, as it is described here it doesn't make much sense to me.
(emphasis on me, as it 'd be that I just can't read fast english
as much as I can write broken english :-)

What I understand from your premices is that you'll fill a
file File(N+1) with the content of the solely first line from
File(N). Seems an easy way to slowly fill a disk with a
numb line )

Maybe the training exercise was just about that, see if you
could think that the algorithm was dumb ?

Or is it just you didn't post the *real* text ?


Anyway, the answer to your post could be something based on :

This is the file feeding part :

(while true; do sleep 1 && date +%F%X >> /tmp/_numb ; done) &

This is the triggering bot :

(( 100 < $(wc -l /tmp/_numb | cut -d' ' -f1 ) )) && echo "CHANGEFILE"
  Réponse avec citation
 
Page generated in 0,04723 seconds with 9 queries