Re: [NEWBIE] Wipeing

From: The Merciless Lord of Everything (serces@mud.dk)
Date: 03/27/01


On Tue, 27 Mar 2001, Its Me Christian wrote:

> How would i go about clearing a whole file. Eg. wimping every thing off a
> file.
I'd say that would be very dependant on your OS :) in Unix ie I'd do a
bash-2.04$ > filename
clearing the file completely :). Otherwise you could remove it and touch
it :).

> or is there a way that i can just clear one line of a file.
What do you use? C? Perl? shellscript? Python or what?

In perl you could do a :

$x =0;
while (<>) {
  $x++;
  if ($x==2) {
    print "anothertextthan what is usually here\n";
  } else {
    print;
  }
}

An educated guess is that this is possible in most languages where you can
either handle STDIN or open a file :).

ooohmm.. :) Yes, this was a bit silly letter perhaps I should go back to
sleep..

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST