File format - Path


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File format - Path
# 1  
Old 09-15-2010
File format - Path

Hello,

I have configuration files like this one :
Code:
  #tronc_staf# /OPERATIONNEL/SATURNE/PLASMA
   
  #nbr_feuille_par_#branche# acc 21
  #nbr_feuille_par_#branche# arc 21
  #nbr_feuille_par_#branche# glo 21
  #nbr_feuille_par_#branche# glo4 21

So far I have manged to create an interactive script to choose the configutaion file to choose, but I am stuck to create a loop that I could used to get this :
Code:
  /OPERATIONNEL/SATURNE/PLASMA/ACC
  /OPERATIONNEL/SATURNE/PLASMA/ARC
  /OPERATIONNEL/SATURNE/PLASMA/GLO
  /OPERATIONNEL/SATURNE/PLASMA/GLO4

The idea is the use each line given, one by one, inside a specific command line to print the data files inside of each directories.

Thanks for your help
# 2  
Old 09-15-2010
hey can you explain me more clearly what are you expecting?
Code:
  /OPERATIONNEL/SATURNE/PLASMA/ACC
  /OPERATIONNEL/SATURNE/PLASMA/ARC
  /OPERATIONNEL/SATURNE/PLASMA/GLO
  /OPERATIONNEL/SATURNE/PLASMA/GLO4

are all these directories and you want to search these directories automatically and then for each directory selected you want to search for the files inside it.. then find the correct congfiguration file?? ?
# 3  
Old 09-15-2010
Hello,

I am sorry, I sould be more clear on my needs.

in fact I am trying to create a loop that will add the directoy name to the static path :

here is what I am trying to get :

Code:
/OPERATIONNEL/SATURNE/PLASMA/ACC
/OPERATIONNEL/SATURNE/PLASMA/ARC
/OPERATIONNEL/SATURNE/PLASMA/GLO
/OPERATIONNEL/SATURNE/PLASMA/GLO4

all are directories.

I am trying to create a shell script (KSH) that will use configuration file to look at the data's in each directorie.

ok let say :

str = /OPERATIONNEL/SATURNE/PLASMA
brh = ACC ARC GLO

I am trying to write a loop like this :

Code:
for each line in $brh ; do
echo $str/$brh
done

but i am not good enough to make it to work

Thanks

Last edited by Aswex; 09-15-2010 at 11:26 AM..
# 4  
Old 09-15-2010
Try this:

Code:
for each line in "$brh"
do
   echo $str/$line
done

HTH

Last edited by bluescreen; 09-15-2010 at 01:28 PM..
This User Gave Thanks to bluescreen For This Post:
 
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. Shell Programming and Scripting

Need help to format one txt file to required format

Hello Everyone, I have one source file which is genarated by SAP in different format(Which I've never seen). I need to convert that file to required format and I need to read this target file from Datastage to use this in my Jobs. So I do not have any other options except to use Unix script to... (4 Replies)
Discussion started by: Prathyu
4 Replies

3. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

4. Shell Programming and Scripting

Retrieve directory path from full file path through sh

Hi, I have a file abcd.txt which has contents in the form of full path file names i.e. $home> vi abcd.txt /a/b/c/r1.txt /q/w/e/r2.txt /z/x/c/r3.txt Now I want to retrieve only the directory path name for each row i.e /a/b/c/ /q/w/e/ How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies

5. Shell Programming and Scripting

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (2 Replies)
Discussion started by: Samtel
2 Replies

6. UNIX for Dummies Questions & Answers

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (1 Reply)
Discussion started by: Samtel
1 Replies

7. UNIX for Dummies Questions & Answers

To convert multi format file to a readable ascii format

Hi I have a file which has ascii , binary, binary decimal coded,decimal & hexadecimal data with lot of special characters (like öƒ.ƒ.„İİ¡Š·œƒ.„İİ¡Š· ) in it. I want to standardize the file into ASCII format & later use that as source . Can any one suggest a way a logic to convert such... (5 Replies)
Discussion started by: gaur.deepti
5 Replies

8. UNIX for Dummies Questions & Answers

Convert UTF8 Format file to ANSI format

:confused: Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on... (9 Replies)
Discussion started by: rajreddy
9 Replies

9. UNIX for Advanced & Expert Users

Convert UTF8 Format file to ANSI format

:) Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on this.........Let me... (1 Reply)
Discussion started by: rajreddy
1 Replies

10. UNIX for Dummies Questions & Answers

vi - replacing a relative path with absolute path in a file

Hi, I have a file with about 60 lines of path: app-defaults/boxXYZ....... I want to change this to /my/path/goes/here/app-defaults/boxXYZ, but of course vi doesn't like the regualr :s/old/new/ command. Is there any other quick way to do this? Thanks ;) (2 Replies)
Discussion started by: Yinzer955i
2 Replies
Login or Register to Ask a Question