Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

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 headerConcatenate 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!

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!

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!

edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264
deleted 14 characters in body
Source Link

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

99999999999999999999999

AOISCJNWDC

File1
> MGBNCNOSNC_142
9u2o4840204a9
> MGBNCNOSNC_143
AOISCJNWDCSNDCCW
> MGBNCNOSNC_144
AOISCJ40204DZZW

File2

'>King _henry

'>Queen_jerry

File2
>King_Henry
>Queen_jerry
>Jack_jill

Ouput

'>MGBNCNOSCNC_142 > King_henry

99999999999999999999999

AOISCJNWDC

'>MGBNCNOSCNC_143 > Queen_jerry

1973rh971731973

etc...

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!

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

99999999999999999999999

AOISCJNWDC


File2

'>King _henry

'>Queen_jerry


Ouput

'>MGBNCNOSCNC_142 > King_henry

99999999999999999999999

AOISCJNWDC

'>MGBNCNOSCNC_143 > Queen_jerry

1973rh971731973

etc...

Thanks for any help and let me know if I can be any clearer!

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!

Source Link
Loading