Script Path Help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Path Help
# 1  
Old 02-18-2010
Script Path Help

I have the following paths in a flat file
Code:
/app00/app/mdbsorap/oradata/mfprd/system01.dbf
/app00/app/mdbsorap/oradata/mfprd/system02.dbf
/app00/app/mdbsorap/oradata/mfprd/system03.dbf
/app00/app/mdbsorap/oradata/mfprd/system04.dbf
/app00/app/mdbsorap/oradata/mfprd/system05.dbf

what i would like to do is the following
Code:
cd /app00/app/mdbsorap/oradata/mfprd/
tar this file system01.dbf


Last edited by radoulov; 02-18-2010 at 06:39 AM.. Reason: Please use code tags!
# 2  
Old 02-18-2010
Try this....
Code:
#!/bin/sh
cd /app00/app/mdbsorap/oradata/mfprd/
ls system*.dbf | while read FILE
do
#tar $FILE
done

# 3  
Old 02-18-2010
Quote:
Originally Posted by gseptember
I have the following paths in a flat file
Code:
/app00/app/mdbsorap/oradata/mfprd/system01.dbf
/app00/app/mdbsorap/oradata/mfprd/system02.dbf
/app00/app/mdbsorap/oradata/mfprd/system03.dbf
/app00/app/mdbsorap/oradata/mfprd/system04.dbf
/app00/app/mdbsorap/oradata/mfprd/system05.dbf

what i would like to do is the following
Code:
cd /app00/app/mdbsorap/oradata/mfprd/
tar this file system01.dbf


Code:
cd /app00/app/mdbsorap/oradata/mfprd/
tar cf system01.dbf.tar system01.dbf


If you want to make a tarball of all the .dbf files:
Code:
tar cf dbf.tar $( cat path_to_flat_file )

That assumes that there is no whitespace in the filenames.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

2. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

3. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

4. Shell Programming and Scripting

Grep script name with path

would like to grep everything from first occurrence of / until >(not includes) example : 0 5 * * * /usr/local/bin/shell/test.sh >/tmp/test.log Output would be : /usr/local/bin/shell/test.sh (4 Replies)
Discussion started by: jhonnyrip
4 Replies

5. UNIX for Dummies Questions & Answers

Getting path name using bash script

I have this code to extract the directory name ($0:h) in tcsh. I am converting the code to bash and need a way to get the equivalent setting for DefRaytracPath set DefRaytracPath = `echo $0:h | awk 'BEGIN {FS="/tcsh"} {print $1"/prog"}'` (3 Replies)
Discussion started by: kristinu
3 Replies

6. Shell Programming and Scripting

absolute path for a script ran with relative path

I have a script in which i want to print absolute path of the same script irrespective of path from where i run script. I am using test.sh: echo "pwd : `pwd`" echo "script name: $0" echo "dirname: `dirname $0`" when i run script from /my/test/dir/struct as ../test.sh the output i... (10 Replies)
Discussion started by: rss67
10 Replies

7. Shell Programming and Scripting

Executing Commands From Non-Standard Path (Changing user's PATH secretely???)

Hi: I have a requirement as below: I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l). When any user logs on and types... (2 Replies)
Discussion started by: ramesh_samane
2 Replies

8. Shell Programming and Scripting

Maintain full path of a script in a var when sourcing it from a different script

Hi All, I've searched through the forum for a solution to this problem, but I haven't found anything. I have 2 script files that are in different directories. My first script, let's call it "/one/two/a.sh" looks like this: #!/bin/sh IN_DIR=`dirname $0` CUR_DIR=`pwd` cd $IN_DIR... (4 Replies)
Discussion started by: mrbluegreen
4 Replies

9. Shell Programming and Scripting

getting a shell script to know it's path

Is it possible in Bash (or any other shell) to get a shell script to know it's own path without having to be part of $PATH or anything like that. I need this cos i want the script to be able to rename the directory in which it resides. is this possible? (6 Replies)
Discussion started by: Nat
6 Replies

10. UNIX for Dummies Questions & Answers

Set PATH using a script

I am a corporate user of Solaris ?? I have to write a lot of scripts to do little repetitive actions. To make this easier I would like to set the PATH so that I do not have to type ./ first before the script name. Is there an easy script that will allow me to set this path when I log in??? ... (2 Replies)
Discussion started by: jagannatha
2 Replies
Login or Register to Ask a Question