I have 48411 K FASTA sequences, each 1555 characters in length (in a single file, 78.3 Mb total) with headers as follows:
CYTC2889-12 HM036578 Homo sapiens
but unfortunately, spaces have been used to delimit text instead of the usual '|' (I think).
I'd like to add '|' to headers so that they become
CYTC2889-12|HM036578|Homo sapiens
I just need to replace the first two spaces. There should not be a pipe in the species name. Thus, the end result should be "Homo sapiens" not "Homo | sapiens".
I'm unsure how to proceed since all spaces would be replaced by a pipe instead of just within the first two identifiers (CYTC2889-12 and HM036578 in the above example) as pointed out by @CharlesDuffy.
It seems like a simple task (?), but I'm getting thrown off by the use of spaces as delimiters (or so I assume this is how spaces are being used).
Any thoughts?