[GAP Forum] question about strings

Justin C. Walker justin at mac.com
Thu May 24 17:29:32 BST 2007


On May 24, 2007, at 08:47 , Joao Araujo wrote:

> 1. the original files are very very big. It might take hours to  
> reach the end of the file using the scroll of nano or pico. So I  
> have been transfering the files to a Windows machine and use a word  
> processor to
> reach the end (and put ";; ). Then send the file back to the unix  
> machine.

Sheesh...you're working pretty hard to get these two characters in  
there...

Your best bet is to write a small C program to do the job:
    main(...)
    {
       fd = open(...);
       lseek(fd, 0, SEEK_END);
       write(fd, ";;\n", 3);
    }

That, obviously, has not been compiled or tested :-}, nor is there  
any error-checking.  It will beat the pants off the "scroll to the  
end and type ';;'" process, though.

There may even be Perl or Pythonic ways of doing the same thing.   
Look for "seek" or "append" methods in these scripting languages.  In  
essence, you want to seek to the end of the file, write the two  
characters there, and close the file.

If you have a number of files to deal with, just put those operations  
in a loop.

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Absorption of Federal Funds
--------
If you're not confused,
You're not paying attention
--------





More information about the Forum mailing list