[GAP Forum] question about strings

Joao Araujo mjoao at classic.univ-ab.pt
Thu May 24 16:47:25 BST 2007


I use some programs to produce a file, say text.txt with content

This is
the
file.

and I want to use GAP to manipulate it. In order to do that I 
open the file and write

u:="This is
the
file.";;

Then I save the file and run

perl -e 'while (<>) { if (! /\|$/ ) { chomp; } print ;}' text.txt > text.out

in order to remove line breaks.

Finally I open a GAP session and write

gap> READ("text.out");

to get my original file in the string u.

However:

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.

2. I have dozens of files of this kind...

Therefore I would be very grateful if someone could help me devise a 
faster and more automatic way to put the original text.txt file into a 
GAP string.

Many thanks,
Joao



More information about the Forum mailing list