I have the answer/solution for you.
Firstly, apologies for my bad english level, i'll try to do my best.
I was looking for the same thing that you but i cant find anything. I made a script to do this automatically and it works. Here's the code:
# get lines of text from serial port, save them to a file
from __future__ import print_function
import serial, io
addr = '/dev/ttyUSB0' # serial port to read data from
baud = 9600 # baud rate for serial port
fname = '/home/gps.dat' # log file to save data in
fmode = 'a' # log file mode = append
with serial.Serial(addr,9600) as pt, open(fname,fmode as outf:
spb = io.TextIOWrapper(io.BufferedRWPair(pt,pt,1),
encoding='ascii', errors='ignore', newline='\r',line_buffering=True)
spb.readline() # throw away first line; likely to start mid-sentence (incomplete)
x = spb.readline() # read one line of text from serial port
print (x,end='') #echo line of text on-screen
outf.write(x) #write line of text to file
outf.flush() #make sure it actually gets written out
This is the script that runs the communication. In my case, i have a GPS connect via RS-232 (DB-9) to USB cable to Raspberry PI (Raspbian SO), for that i use ttyUSB0.
In the line that says fname, you can indicate the destiny and name for the file to want capture the info.
If you want to use .dat or .txt format its no problem.
And one thing more. I dont use the gtkterm for this (i was crazy with this terminal).
I think this is so easy way for your quest, and i hope it will be usefully.