Reading reference file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reading reference file
# 1  
Old 01-06-2016
Reading reference file

For file purge and archive script, I am planing to have the reference files as below for various file system.

Code:
>ReferenceFile.cfg

...
...

DailyArchive:
{
FOLDERS      PATERN    DAYS_TO_RETAIN    MINIMUM_SIZE_THESHOLD(MB)
/aaa/bbb/      *             3                          300
/ddd/eee/      *.txt         4
/aaa/ccc/       ABC*        4                          2000
}

Exceptions:
{
EXTENSIONS
.sh
.ksh
.cfg
}

...
...
...

I would read the segment available under DailyArchive to form the list of files to be archived.
Then I would need to read the segment under the Exceptions and ignore the files with specified extensions etc

Is there any smart why read this type of reference file?

I can always, read the file till I reach the Key Word "DailyArchive" and then skip two lines, and then start reading the values till I reach "}"

But is there any other approach being handled with others?

Thanks in advance.

Last edited by deepakwins; 01-07-2016 at 12:42 PM..
# 2  
Old 01-07-2016
Hi,
format of segment DailyArchive is not as format segment Exceptions:
In segment DailyArchive, your have line's comment (FOLDER....) but in segment Exceptions your have not line's comment.
So, how to know if a line is a comment or not ?
Why this file format ?

Regards.
# 3  
Old 01-07-2016
Thanks for pointing it out. I added the Header for the Exceptions too.

Quote:
Originally Posted by disedorgue
Hi,
format of segment DailyArchive is not as format segment Exceptions:
In segment DailyArchive, your have line's comment (FOLDER....) but in segment Exceptions your have not line's comment.
So, how to know if a line is a comment or not ?
Why this file format ?

Regards.
# 4  
Old 01-07-2016
Not sure I understand what you are intending to do - read those values into variables? Compose a command line with parameters and options with them? Feed another tool? Please specify!
# 5  
Old 01-07-2016
Quote:
Originally Posted by RudiC
Not sure I understand what you are intending to do - read those values into variables? Compose a command line with parameters and options with them? Feed another tool? Please specify!
Iam trying to set the Enviornmental variable, and I wanted to store the details under the ENV_VARIABLE. I have more than one parameter value per line time to be stored, hence maintaining the section ArchiveDetails. And the list of all extensions that need to be considired as Exceptions, are maintained under Exception segment. But Iam open for Suggestions. Is there a better way to maintain these information? This configuration file is going to be accessed by many people, hence dont want to make it too technical. I felt, this structure, would make it more readable.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Solaris 11 patch cross reference file

Hi all I wanted to know does solaris 11 have any place to download patch cross-reference file like solaris 10 (h t t p s://getupdates.oracle.com/reports/patchdiag.xref)? I wanted to use this file to filter out those security patches and use it to check if any of my solaris 11 systems are... (0 Replies)
Discussion started by: kaze
0 Replies

2. UNIX for Dummies Questions & Answers

awk to replace values in one file using a second reference file

Hi, I'd be grateful for your help with the following: I have a file with a single column (file1). Let's say the values are: a b c 5 d I have a second, reference file (ref_file), which is colon-delimited, and is effectively a key. Let's say the values in it are: a:1 b:2 c:3 d:4... (4 Replies)
Discussion started by: aberg
4 Replies

3. Shell Programming and Scripting

Compare data with reference from other file

Gents, Please can you help with this. I have a big file (file2) which contends many records increment every 25 rows ( column 1 ). Then I have other file as reference (file1).. column 1 to 11. I want to compare that all values in file2 (column 2 to 12.) match with values in... (2 Replies)
Discussion started by: jiam912
2 Replies

4. Shell Programming and Scripting

Keeping record of file 2 based on a reference file 1 in awk

I have 2 input files (tab separated): file1: make_A 1990 foo bar make_B 2010 this that make_C 2004 these those file2: make_X 1970 1995 ref_1:43 ref_2:65 make_A 1970 1995 ref_1:4 ref_2:21 ref_3:18 make_A 1980 2002 ref_1:7 ref_2:7 ref_3:0 ... (2 Replies)
Discussion started by: beca123456
2 Replies

5. Shell Programming and Scripting

File Reference Matching

Hi, I need help with the below scenario in Bash scripting: I have two files: tmp.orig with the below contents "TEST1" "TEST2" "TEST5" "TEST6" and tmp.new with below contents "TEST1;921" "TEST2;34" "TEST3;2" "TEST4;33" "TEST5;98" "TEST6;1" I need to run tmp.orig against... (10 Replies)
Discussion started by: ChicagoBlues
10 Replies

6. Shell Programming and Scripting

Replace a value using a reference data from other file

Gents, Can you please help me to solve this case In my input file I have a values in column 49 which always need to be one, but sometimes the system create a value 2, in this case I need to go to search in the original file and replace the values in the row where the value 2 is and in the... (6 Replies)
Discussion started by: jiam912
6 Replies

7. Shell Programming and Scripting

Perl :: reading values from Data Dumper reference in Perl

Hi all, I have written a perl code and stored the data into Data structure using Data::Dumper module. But not sure how to retreive the data from the Data::Dumper. Eg. Based on the key value( Here CRYPTO-6-IKMP_MODE_FAILURE I should be able to access the internal hash elements(keys) ... (1 Reply)
Discussion started by: scriptscript
1 Replies

8. Shell Programming and Scripting

Replace from reference file awk

Basically want to replace any field in input file from the refernce file ... for example. clar_2400:3113 in input file will be replaced by clar_2400:3113 Input file field seperator is "," Field which is not found in reference will stay as it is ... Input File ... (3 Replies)
Discussion started by: greycells
3 Replies

9. Shell Programming and Scripting

Perl de-reference code reference variable

Guys, May i know how can we de reference the code reference variable.? my $a = sub{$a=shift;$b=shift;print "SUM:",($a+$b),"\n";}; print $a->(4,5); How can we print the whole function ? Please suggest me regarding this. Thanks for your time :) Cheers, Ranga :) (0 Replies)
Discussion started by: rangarasan
0 Replies

10. Programming

Help to filter read through reference file by using c language

Input_file #tmp_2 werweraewghe @tmp_2 123sdfs57a #tmp_1 aewrgheheghe @tmp_1 457awrerfa87 #tmp_4 trtyrghe @tmp_4 8898rtyr2 reference_file #tmp_4 #tmp_1 (14 Replies)
Discussion started by: cpp_beginner
14 Replies
Login or Register to Ask a Question