tar cmd how many arguments into parameters of filenames


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting tar cmd how many arguments into parameters of filenames
# 1  
Old 06-14-2010
tar cmd how many arguments into parameters of filenames

Hi

I would like to use tar cmd in my script.
I have a variable with filenames, e.g. 1000 records and I would like to paste its values into tar cmd.

For this example I used three elements variable strings.
Code:
strings="file1.txt file2.txt file3.txt"

`tar cf file1.tar $strings`

Whether tar cmd has some restrictions in regard on how many arguments I can pass into file names parameter fields ?

thx for help
# 2  
Old 06-15-2010
Did you get any error?
too many argument limits are there for everything.. ( ls, rm, etc )
I am not sure what is the exact limit for it and on what it is based on ( os? shell? )

but you can always get rid of that with using exec and xargs

how do you populates these file-names? with find probably ?
if yes, then something better is there i think..

Code:
find [ your action ] ...... -exec tar -rf mytar.tar {} \;

or

Code:
find [ your action ] ......  | xargs tar -rf mytar.tar

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Positional Parameters Arguments/Variables when using dot (.)

Hi, Is there a special positional variables for when using the dot (.)? Scripts are as below: $: head -100 x.ksh /tmp/y.ksh ==> x.ksh <== #!/bin/ksh # . /tmp/y.ksh 1234 abcd echo "yvar1 = $yvar1" echo "yvar2 = $yvar2" ==> /tmp/y.ksh <== #!/bin/ksh (2 Replies)
Discussion started by: newbie_01
2 Replies

2. UNIX for Beginners Questions & Answers

Extract values based on parameters passing in arguments

Based on arguments passing in command prompt values should fetch and store in new file. Sample:- sh test.sh 10 30 35 45 cat test.sh .. cut -c $1-$2,$3-$4 file_name >> file_new ... ... Above sample passing 4 arguments.. but it may differ (sh test.sh 10 30 35 45 70 75 ) based on... (1 Reply)
Discussion started by: Jairaj
1 Replies

3. Shell Programming and Scripting

Help with tar cmd for directories

Hi, I'm working on HP-UX B.11.23 64bit. I tried to tar couple of directories but failed to do so. $ tar -cvf tar_file_name -C /dir1 /dir2 the -C is for directories as mentioned in the man pages. But still unable to create a tar file having directories and sub-directories. Requesting help in... (1 Reply)
Discussion started by: sam_bd
1 Replies

4. Shell Programming and Scripting

Naming output files based on variable parameters and input filenames

Hello, I have a series of files in sub-directories that I want to loop through, process and name according to the input filename and the various parameters I'm using to process the files. I have a number of each, for example file names like AG005574, AG004788, AG003854 and parameter values like... (2 Replies)
Discussion started by: bdeads
2 Replies

5. Shell Programming and Scripting

case statement for different cmd arguments

Hello friends, I have a boubt passing different arguments at a time for any one option in below code. I would also like to check which option has been selected (any one of i, r, u ) so that whether or not matching argument passed can be verified. for i and r - install and re-install -... (4 Replies)
Discussion started by: pd2
4 Replies

6. Red Hat

multi tape option in tar cmd

Dear experts, I have to take back up of 1.8TB data in single cmd. I have tape which has the capasity of 600 GB. Hence i want to use multiple tapes to take the backup using tar cmd. Kindly help. -Anand (8 Replies)
Discussion started by: nithyanandan
8 Replies

7. Shell Programming and Scripting

Optional Parameters/arguments while executing a script.

Hello, I have a shell script "Test.ksh" and I need to pass 8 parameters/arguments while executing the script ./Test.ksh 1 2 3 4 5 6 7 8 Out of these I want first 3 to be compulsory and rest 5 to be optional. Can you suggest the way to do this like and also how to pass these optional... (3 Replies)
Discussion started by: indrajit_u
3 Replies

8. Shell Programming and Scripting

Help with adding to tar filenames

Hi there, i have been working on a backup script and have it just about working, the only problem im left with is that my filenames for my backups are all the same are replacing one another when backing up. currently i have BACKUP_FILE=backup_$(date +%d%m%y).tgz but would like something like... (2 Replies)
Discussion started by: Swinton
2 Replies

9. UNIX for Dummies Questions & Answers

tar contains duplicate filenames

I have a problem where tar is somehow creating duplicate filenames when tarring a directory. Doing an ls on the directory does not show any duplicate filenames, yet when the directory is tarred, you can see that there are duplicates: bash-2.03# pwd /var/log/cricket bash-2.03# ls -1 | sort |... (2 Replies)
Discussion started by: dangral
2 Replies

10. Answers to Frequently Asked Questions

Passing variables/arguments/parameters to commands

A good place to start is simple variable passing.... Passing variables from one script to another The next level is passing a variable into a more complex command such as using a variable in a sed command. There are some simple quoting techniques that are very general. These are mentioned... (0 Replies)
Discussion started by: Perderabo
0 Replies
Login or Register to Ask a Question