Closed Geremia closed 2 months ago
Can't think of one, sorry. Doesn't seem like a big deal to me, since you can use cat
on the result of mad
; is there some reason to want a single command?
@Geremia Primarily speed. I have hundreds of thousands of files that I'd like to append to (for padding purposes). Using cat
would slow things down.
Where in the code could I add padding to each file before they're concatenated?
If you're appending many thousands of files, how is using cat
going to be slow?
Adding padding: isn't that just another use of mad
?
@rrthomas mad appendix.txt *.txt
doesn't work (>2 args), and mad appendix.txt \*.txt
simply creates a file named *.txt
whose contents are appendix.txt
. Am I missing something?
parallel mad ../appendix.txt {} ::: *.txt
is far too slow (several minutes for me).
@rrthomas
mad appendix.txt *.txt
doesn't work (>2 args), andmad appendix.txt \*.txt
simply creates a file named*.txt
whose contents areappendix.txt
. Am I missing something?
Sorry, indeed that won't work: you can append multiple sources to one target (so you can use mad
instead of cat
) but you can't append a single source to multiple targets (so you can't use mad
to add the appendix to lots of files).
@rrthomas Thanks for the clarification.
@rrthomas Adding
char null_byte = 0x00;
write(t, &null_byte, 1);
at mmv.c#L1578 achieved what I was looking for. (I only wanted to append one null byte in my specific case to the end of each file before concatenating.)
@rrthomas Is there a way to append a file to each of the matched files and then concatenate all those files, all in one line?
I know the following command doesn't work (due to there being 3 args), but I am trying to do something like this:
where
appendix.txt
is appended to all the*.txt
files and those files (each withappendix.txt
appended to them) are concatenated into one largeconcatenated.txt
?