LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Linux - Server (http://www.linuxquestions.org/questions/forumdisplay.php?f=73)
-   -   script - problem with reading file name (http://www.linuxquestions.org/questions/showthread.php?t=748422)

dlugasx 08-18-2009 08:50 AM

script - problem with reading file name
 
Hello everyone,



this time I have a problem with script which should read file names.

My backup script for SVN generating such a files:




Quote:

#! folder_with_repositories+repositoryname.tgz
where foldername means directory with repositories.


in the linux directory tree it looks like this:


Quote:

/svn/folder_with_repositories
|
|
- repositoryname
|
- repositoryname01
|
- etc. etc.....

In my restore script I would like to read a part of the backup file name.

First I would like to ready part till "+" and then part after "+".


So, using the name of the backup file I would like to restore SVN directory tree.


If file has a name:

INPUT

Quote:

#! folder_with_repositories+repositoryname.tgz
I would like to have a command which will create folder using backup file name.


OUTPUT

Quote:

/svn/folder_with_repositories
|
|
- repositoryname
Name till "+" means folder with repositories.

Name after "+" maens folder with repository.


Do You know how can I do this ? AWK ?


Extensions .tgz from the file should be droped.


help...

catkin 08-18-2009 02:22 PM

Can you post that again using code tags? That's CODE and /CODE in [] brackets. If you switch to advanced mode there's a # icon that automates it.


All times are GMT -5. The time now is 06:44 AM.