[GAP Forum] question about strings

Steve Linton sal at cs.st-and.ac.uk
Thu May 24 18:11:53 BST 2007


There is a GAP function StringFile which probably does what you want.

	Steve

-----Original Message-----
From: "Joao Araujo" <mjoao at classic.univ-ab.pt>
To: forum at gap-system.org
Sent: 24/05/07 16:47
Subject: [GAP Forum] question about strings


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

_______________________________________________
Forum mailing list
Forum at mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum




More information about the Forum mailing list