python - Constant time text file modification -
i have set of large files (about 50 megabytes each, , @ least hundred of them), need insert small header (about 2 dozen lines) onto each 1 processing purposes. hoping write script in either bash or python it, can't find constant-time function let me insert @ front of text file. if not constant time, think it'll take long complete. have experience issue?
similar uwe's answer, if processing tool can accept parameters filenames, can fake 1 mkfifo(1).
for example, in bash...
echo 'my header' > header.txt echo 'my content' > content.txt mkfifo fakefile.txt cat header.txt content.txt > fakefile.txt & cat fakefile.txt ...would stream contents of 2 files, rather creating new file.
Comments
Post a Comment