Cat Command

Solved
Hello, I need to merge 3 text files into 1 and then separate them with ****** (aster). I can't figure out which command I could use in conjunction with Cat. I'm using Fedora 14.

Thank you in advance.

5 answers

  1. Contributor
    hello
    (cat file1 ; echo "*****" ; cat file2 ; echo "******" ; cat file3) >file 
    or use head to have a separator
    head -999999 file1 file2 file3 >file 
    1. Thank you so much for your answers. It's exactly what I was looking for. This is my first time posting on this site and wow, what a result! Thank you for taking the time to respond to me. See you later, guys!
      1. hi,

        with cat only, I don't see how to do it :(
        well yes, if you have control of the terminal
        cat fic1 - fic2 - fic3

        you type *****, then Enter, then Ctrl-D, each time the command returns the terminal.
        but it's not very convenient ;)

        can you use other tools?

        with sed
        sed -s '$a*****' fic1 fic2 fic3

        with awk
        awk '{if(NR>FNR){NR=1; printf("%s\n%s\n","*****",$0)}else{print}}' fic1 fic2 fic3
        1. Pour this part it’s fine, actually what I would like to do is once the 3 texts are gathered, I would like to separate the texts in the new file with ***. Simply to be able to distinguish them.
          cat fichier1 fichier2 fichier3 > fichier | ??????
          Thank you