LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-18-2009, 09:50 AM   #1
dlugasx
Member
 
Registered: Dec 2008
Location: Germany/Poland
Distribution: CentOS / Debian / Solaris / RedHat
Posts: 250

Rep: Reputation: 18
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...

Last edited by dlugasx; 08-19-2009 at 03:47 AM.
 
Old 08-18-2009, 03:22 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
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.
 
  


Reply

Tags
file, name


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a conf file from a BASH script dinolinux Programming 5 08-03-2005 05:18 AM
Need help reading text file in bash script scilec Programming 3 11-25-2004 07:44 PM
Bash script - reading from text file twantrd Programming 4 11-24-2004 01:38 AM
reading file, bash script marri Programming 3 11-15-2004 10:13 AM
Script, Reading a file, When end of file? elibm Programming 2 07-16-2001 12:01 PM


All times are GMT -5. The time now is 09:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration