[Scottish] editors
David Irvine
scottish at mailman.lug.org.uk
Sat Mar 8 23:33:01 2003
Assuming your a glutten for punishment :)
cat - >>newfile will allow you to create files, ctrl-z when your done
now you can create files....
and assuming you have perl.....
you can now paste into your terminal the following:
#!/usr/bin/perl
#
my @lines;
my $line=0;
while (my $oldfile=<STDIN>){
@lines[$line++]=$oldfile;
}
my @newfile;
foreach $line(@lines){
print $line;
my $newline=<STDIN>;
if ($newline=~m/^\n/){
push @newfile,$line;
}else{
push @newfile,$newline;
}
}
foreach $line(@newfile){
print $line;
}
which will give you a very crude text editor in perl....
so
$ perl foo.pl <oldfile
it goes through each line and asks for the replacement line (I todl you
it was crude)
press enter if its correct, amend it if its not and when it gets through
each line it spits it all out.
Of course you could add file handlers to save the file to a new name,
but that was just to illustrate the point.
You could also use awk or sed to amend the file. Remember when using
sed/awk not to redirect to the input file, since that has a tendancy to
hose it compeltely.
HTH
David
On Sat, 2003-03-08 at 22:06, Allan Bruce wrote:
> Why dont you ftp the file to another machine and edit it there?
> Allan
>
>
> ----- Original Message -----
> From: "george" <george@experimentalmonkey.co.uk>
> To: <scottish@mailman.lug.org.uk>
> Sent: Saturday, March 08, 2003 9:19 PM
> Subject: [Scottish] editors
>
>
> >
> > I have to alter the php.ini file sitting on a server, the problem is
> > that there doesnt seem to be any editors installed, and I dont have the
> > option of installing one. I think I am pretty much knackered but I am
> > open to suggestions
> >
> > George
> >
> >
> > _______________________________________________
> > Scottish mailing list
> > Scottish@mailman.lug.org.uk
> > http://mailman.lug.org.uk/mailman/listinfo/scottish
> >
>
> _______________________________________________
> Scottish mailing list
> Scottish@mailman.lug.org.uk
> http://mailman.lug.org.uk/mailman/listinfo/scottish