how to copy a file without remove the contents of the target file?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to copy a file without remove the contents of the target file?
# 1  
Old 04-22-2011
how to copy a file without remove the contents of the target file?

Hello every body,
Kindly support me to "copy a file without remove the contents of the target file"

Thanks in advance. Smilie

Ahmed Amer
Cairo,Egypt
# 2  
Old 04-22-2011
Code:
cat source >> target

Your question is somewhat vague. Please elaborate.
This User Gave Thanks to Scott For This Post:
# 3  
Old 04-22-2011
I have a file in the path /Desktop/file.txt
then when i run
#cat /Desktop/file.text
Hello
welcome to unix

and i have another file /Desktop/file2.txt
when i run
#cat /Desktop/file2.txt
Welcome to Egypt



I want to copy the contents of /Desktop/file1.txt to /Desktop/file2.txt WITHOUT removing the contents of Desktop/file2.txt
i.e. to get the following results after i run the following command:
#cat /Desktop/file2.txt
welcome to unix
welcome to Egypt
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script which will check the target file and folder exists and copy it

Hi All, I am a beginner in this and trying to write a shell script in linux which will : 1. Ask for a file name and check if its exists. 2. If file exists only then it will ask for the new target folder, after entering target folder name it will check if it exists. 3. If target folder... (3 Replies)
Discussion started by: ashish_neekhra
3 Replies

2. Shell Programming and Scripting

Copy contents of one file to another

I need to write a script (in bash) that copies the content of the first file in each folder of a directory to the second file in the same folder. I tried this and it didn't work - it just came back with errors and I'm not sure how to fix it. Help is very much appreciated! for mpdir in... (4 Replies)
Discussion started by: LeftoverStew
4 Replies

3. UNIX for Dummies Questions & Answers

ftp to copy file within target machine

I have ftp'd to a machine and have to copy a file from one directory to other. I thought once I am logged in using ftp, cp command would do it. But when I run the cp command, I get the following: ftp> cp * ../../../../maint/ usage: cp Is using cp the only/right option? Thanks in advance! (2 Replies)
Discussion started by: sunny8107
2 Replies

4. Shell Programming and Scripting

Need help to copy contents of a file

Hi, I am stuck up with a problem of copying the contents of a directory where one of the folder name is changed daily. Problem: I have the folder structure as: RefWorlds2/LINGCC4_X64/odsdev/odessy/UTI/621GA_build_xxx/.../.. In the above path the build number (xxx) will be changed... (3 Replies)
Discussion started by: SathaKarni
3 Replies

5. Shell Programming and Scripting

copy the contents between two keywords to a new file.

Hi All, I want to edit my gate level netlists by searching for the content between two patterns eg: ff1 \test/a0 ( .CLK(\test/ClkInt0_acb_00x1 ),.D(\test/Rakicc ), .QB(\test/X ), .VDD(1'b1), .VSS(1'b0)); ff1 \test/a1 ( .CLK(\test/medis0_acb_00x1 ),.D(\test/hedwc ), .QB(\test/X ),... (6 Replies)
Discussion started by: naveen@
6 Replies

6. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

7. Shell Programming and Scripting

Remove the contents of a file without deleting the file

Hi All, I want to delete the contents of few files which are really huge in size. How the same can be done by using sed. Is there any other alternative to sed. Thanks in advance (10 Replies)
Discussion started by: sumesh.abraham
10 Replies

8. UNIX for Dummies Questions & Answers

append file name contents to a target file

Hi , I want to append the contents of many files (not knowing exactly how many files, i will get) in to one target file on a day today basis. The file names are similar except last value (which is sequence number) eg) file1_20061026_1 file1_20061026_2 etc., How can i read all the files... (2 Replies)
Discussion started by: gopskrish
2 Replies

9. Shell Programming and Scripting

Automatic Copy of File Contents to Clipboard

Could someone show me how to copy the contents of a file to the clipboard automatically without manually selecting its contents? I just want to press the "Paste Key" to show the results. I wish to use this in a ksh script. I'm using Solaris. Thanks! (5 Replies)
Discussion started by: ilak1008
5 Replies

10. Shell Programming and Scripting

Copy selected contents from file

I want to capture contents of a file between 2 strings into another file for eg all lines in between the keywords "start log" and "end log" should be copied into another file (4 Replies)
Discussion started by: misenkiser
4 Replies
Login or Register to Ask a Question