so I have found a question on here that is the opposite of what I would like to do here: Concatenate multiple files with same header.
I am trying to merge or concatenate 2 files,within a directory within hundred of files that have a counterpart file with the same substring, into one file based on the '>' character in the header. There are thousands of headers within the each file and as opposed to the question asked in the link I attached, the contents other than the header are the same so I don't want to change anything but every line that begins with '>'.
Essentially I would like to combine file1 to file2 by the shared character '>' and to leave the contents of file 1 in order.
File1
> MGBNCNOSNC_142
9u2o4840204a9
> MGBNCNOSNC_143
AOISCJNWDCSNDCCW
> MGBNCNOSNC_144
AOISCJ40204DZZW
File2
>King_Henry
>Queen_jerry
>Jack_jill
Output
> MGBNCNOSCNC_142 > King_henry
9u2o4840204a9
> MGBNCNOSCNC_143 > Queen_jerry
AOISCJNWDC
> MGBNCNOSNC_144 > Jack_jill
gefSCJ40204DZZW
Thanks for any help and let me know if I can be any clearer!
>
(as indicated in your text) or with'>
(as apparently shown in your sample input). Finally, it would be easier to test potential solutions if yourFile1
extract were larger (at least including the pattern that should be matched toQueen_jerry
).>
?