There are two stages to this, firstly get all the files you want to edit into the argument list, then add the filename to the lines.
1) Add files to argument list.
Either start vim with "gvim *.txt" (if your shell can handle 700 files listed on the command line) or, load gvim with no files open (so the argument list is empty) and then:
cd /path/to/files
" Get the list of files
let filelist = glob('*.txt')
" Add files to the argument list
for file in split(filelist, '\n')
exe 'argadd ' . file
endfor
2) Do the required filtering on all files:
:argdo %s/^/\=expand('%:t') . ' '/ | w
Explanation:
argdo
runs the command on every file in the argument list.
%s/FROM/TO/
replaces FROM with TO
^
is the start of the line (so the replacement adds TO to the start of the line)
\=
means that TO should be the result of an expression
expand('%:t')
gives the name of the current file (%), only including the tail (':t'), so no leading directory name.
. ' '
appends a space.
|
is the command joining character, so after the substitution, it runs:
w
, which writes the file to disk.