Search code examples
bashshellunixscriptingmerge-file

how to merge/append one file content to another file using shell script


I have two file fileA and fileB

FileA content

PersonName Value1 Value2 Value3

FileB content

ALBERT check1 check1 check1
ALBERT check2 check2 check2
ALBERT check3 check3 check3

I want to merge content of fileA and fileB and FileA content should be the first line in the merged file

I tried using paste and sort command... not not able to get required result any suggestions...


Solution

  • cat FileA FileB > NewFile
    

    or

    cat FileA > NewFile
    cat FileB >> NewFile