Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    cp file1 + file2 + file3 /destination/name


    Hi ,

    I am not having success in trying to copy (add) several file into one file for editing purposes. Will the cp command do this?
    If not what commend will do this?

    Thanks

    RF

  2. #2
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    cp won't do it, it will only copy multiple files into a directory. What you can use is cat, and redirect the output to a new file:
    Code:
    cat file1 file2 file3 > newfile
    Beware that the above command will replace newfile if it already exists. If you want to add the contents of some files to an already existing file, you can do this:
    Code:
    cat file1 file2 file3 >> existingfile
    Note the double >> symbol, which appends to the file rather than overwriting it.
    Stand up and be counted as a Linux user!

  3. #3
    Thank you, Thank you
    RF

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •