in reply to Prepending header line to HUGE csv file
Of course, if the line to be prepended is really long or complicated, you can use a text editor or other method to create a small file containing just that first line (e.g. a file called "new.first.line"), and do this:echo "This is the new first line" | cat - big.file > new.big.file
I'm pretty sure there's no faster way it can be done. Of course, speed varies according to things like: Is the output being written to a local disk, or some sort of remote, network-mounted disk? (local storage is much faster) What sort of file system is it? ("Journaled" file systems might be slower), etc.cat new.first.line big.file > new.big.file
|
|---|