|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi
I want to write a UNIX shell script to concatenate 2 files: Assume that I have File1 and File2 My need is to concatenate in the head of File2 the content of File1 without erasing File2 The same thing that do tee –a but in the head of the file not in end , is it possible ? Thanks for your Help ! |
|
#2
|
|||
|
|||
|
your best unix friend is called 'man', so
man cat will show you the manual pages of cat command if you don't have man, google for 'unix man cat' |
|
#3
|
|||
|
|||
|
Hi,
with cat file1 file2 > file2 can i be sure that i dont lose changes made on file2 if the commande take time ? Thanks |
|
#4
|
|||
|
|||
|
that will first zeroing file2
Last edited by guggach : December 23rd, 2004 at 05:12 AM. Reason: typo |
|
#5
|
|||
|
|||
|
Quote:
This is not correct. Read in some tutorial about expanding of the command line. The redirection is made before sending the command to the lower structures of Unix. Your command only deletes the file2 and then catinates file1 into file2. The only possibility is to use a temporary file and then rename it: cat file1 file2 > file3 mv file3 file2 I have made the same error many years ago too... ![]() |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > concatenate files ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|