Sponsored Content
Top Forums Shell Programming and Scripting Append files to a existing tar file. Post 302539429 by Nagaraja Akkiva on Sunday 17th of July 2011 12:08:00 PM
Old 07-17-2011
One more update.

I used below command if tar file existing.
Code:
tar rvf <tar file name> <additional files to append> , 

tar command was successful but when I untarred it, tar had only one file which was tarred first.

Please see the below code.
Code:
[user@dbname processed 04:31:05 AM]$tar zcvf FileName122011.tgz FileName_20110325101.dat
FileName_20110325101.dat
[user@dbname processed 04:31:05 AM]$tar rvf FileName122011.tgz FileName_20110325102.dat
FileName_20110325102.dat
[user@dbname processed 04:31:05 AM]$ls -ltr For*
-rwxrwSrwt 1 root root 402 Jul 16 02:48 FileName_20110519054238_0.dat
-rwxrwSrwt 1 root root 402 Jul 16 02:48 FileName_20110519053824_0.dat
-rwxrwSrwt 1 root root 415 Jul 16 02:48 FileName_20110519EP_vaL_2.dat
-rwxrwSrwt 1 root root 608 Jul 16 02:48 FileName_20110602031917_0.dat
-rwxrw-r-x 1 root root 416 Jul 17 11:42 FileName_20110325101.dat
-rwxrwSr-t 1 root root 416 Jul 17 11:51 FileName_20110325102.dat
-rwxrwxrwx 1 root root 10618 Jul 17 11:53 FileName122011.tgz
[user@dbname processed 04:31:05 AM]$rm -rf FileName_20110325102.dat
[user@dbname processed 04:31:05 AM]$rm -rf FileName_20110325101.dat
[user@dbname processed 04:31:05 AM]$ls -ltr For*
-rwxrwSrwt 1 root root 402 Jul 16 02:48 FileName_20110519054238_0.dat
-rwxrwSrwt 1 root root 402 Jul 16 02:48 FileName_20110519053824_0.dat
-rwxrwSrwt 1 root root 415 Jul 16 02:48 FileName_20110519EP_vaL_2.dat
-rwxrwSrwt 1 root root 608 Jul 16 02:48 FileName_20110602031917_0.dat
-rwxrwxrwx 1 root root 10618 Jul 17 11:53 FileName122011.tgz
[user@dbname processed 04:31:05 AM]$tar zxvf FileName122011.tgz
FileName_20110325101.dat
gzip: stdin: decompression OK, trailing garbage ignored
tar: FileName_20110325101.dat: Cannot utime: Operation not permitted
tar: Child returned status 2
tar: Error exit delayed from previous errors


Last edited by Franklin52; 07-17-2011 at 02:14 PM.. Reason: Please use code tags for data and code samples, thank you
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

delete a file from an existing Solaris tar

How can I delete a file from an existing Solaris tar file ? (not gtar) (2 Replies)
Discussion started by: avnerht
2 Replies

2. UNIX for Advanced & Expert Users

Shell script to append a time for the existing error log file

Hi Guys, the requirement is like this, i am having a error log file in this format, 4594.493: parallel nursery GC 2594592K->2544691K (2969600K), 30.848 ms 4605.958: parallel nursery GC 2634887K->2584986K (2969600K), 38.900 ms 4619.079: parallel nursery GC 2822555K->2774812K... (12 Replies)
Discussion started by: gsprasanna
12 Replies

3. AIX

append file with tar command

hello, can i append files into tape without clear this tape thanks for help (3 Replies)
Discussion started by: mbakry23
3 Replies

4. UNIX for Dummies Questions & Answers

how to add files to an existing tar file - HP-UNIX

Hello, What is the command to add files to an existing tar file. Thanks, (5 Replies)
Discussion started by: Nomaad
5 Replies

5. Shell Programming and Scripting

Adding file to an existing tar

Hi Friends, I want to know the command to add a new file in a existing tar file. For Ex: I have a tar file file1.tar with the contents one.txt two.txt three.txt Now I need to add file four.txt to this existing tar file, how can I do it? Thanks in advance (4 Replies)
Discussion started by: mr_manii
4 Replies

6. Shell Programming and Scripting

append existing file with zeroes bsed on position

Hi i am trying to append value with 0 to an existing file in the position 50-56 & 58-64 only where empty space is there Rule: 1 row already has some value and i do not want to change anything for this row. 2nd record below you see the position 50-64 is empty, i want to replace with 0000000... (3 Replies)
Discussion started by: kshuser
3 Replies

7. Shell Programming and Scripting

Append to existing line

I have a file which has lines that end with a plus (+) sign. I would like to get the next line appended to the one with the plus. For example bla bla bla bla bla + blip blip blip would become bla bla bla bla bla blip blip blip However not all lines end with a plus sign . I would... (2 Replies)
Discussion started by: bombcan
2 Replies

8. Solaris

Command to remove existing files in the tar files in Solaris 10

Hi, I am using solaris 10 OS.Please help me out with the commands needed in below two scenarios. 1)How to delete the existing files in the tar file. suppose i have a main tarfile named application.tar and it contains a file called ingres.tar. what is the command to remove ingres.tar... (2 Replies)
Discussion started by: muraliinfy04
2 Replies

9. Shell Programming and Scripting

Matching column then append to existing File as new column

Good evening I have the below requirements, as I am not an experts in Linux/Unix and am looking for your ideas how I can do this. I have file called file1 and file2. I need to get the second column which is text1_random_alphabets and find that in file 2, if it's exists then print the 3rd... (4 Replies)
Discussion started by: mychbears
4 Replies

10. Shell Programming and Scripting

Append files (backup .tar)

Hi all, I have to write a script which will keep for a particular user (username is first argument) backups of the account area to another. The script should accept as the second argument is a directory (or file), create one by storing a copy of the argument (using tar) and copies it to the list... (0 Replies)
Discussion started by: peter20
0 Replies
TAR(1)							      General Commands Manual							    TAR(1)

NAME
tar - archiver SYNOPSIS
tar key [ file ... ] DESCRIPTION
Tar saves and restores file trees. It is most often used to transport a tree of files from one system to another. The key is a string that contains at most one function letter plus optional modifiers. Other arguments to the command are names of files or directories to be dumped or restored. A directory name implies all the contained files and subdirectories (recursively). The function is one of the following letters: c Create a new archive with the given files as contents. x Extract the named files from the archive. If a file is a directory, the directory is extracted recursively. Modes are restored if possible. If no file argument is given, extract the entire archive. If the archive contains multiple entries for a file, the lat- est one wins. t List all occurrences of each file in the archive, or of all files if there are no file arguments. r The named files are appended to the archive. The modifiers are: v (verbose) Print the name of each file treated preceded by the function letter. With t, give more details about the archive entries. f Use the next argument as the name of the archive instead of the default standard input (for keys x and t) or standard output (for keys c and r). u Use the next (numeric) argument as the user id for files in the output archive. This is only useful when moving files to a non-Plan 9 system. g Use the next (numeric) argument as the group id for files in the output archive. EXAMPLES
Tar can be used to copy hierarchies thus: {cd fromdir; tar c .} | {cd todir; tar x} SOURCE
/sys/src/cmd/tar.c SEE ALSO
ar(1), bundle(1), tapefs(1) BUGS
There is no way to ask for any but the last occurrence of a file. File path names are limited to 100 characters. The tar format allows specification of links and symbolic links, concepts foreign to Plan 9: they are ignored. TAR(1)
All times are GMT -4. The time now is 01:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy