Sponsored Content
Top Forums Shell Programming and Scripting Increment a value in a configuration file. Post 302518026 by jaysunn on Thursday 28th of April 2011 12:56:15 PM
Old 04-28-2011
That is so amazing. Thank you so so much. This helps me learn as well.


Code:
[root@sysmon prod]# perl perl_script.pl file 

[root@sysmon prod]# cat file 

$CFG['Sources']['Source1']['ID'] = 'Source1';

$CFG['Sources']['Source1']['Name'] = 'Prod_log1';

$CFG['Sources']['Source1']['SourceType'] = 1;

$CFG['Sources']['Source1']['LogLineType'] = 'syslog';

$CFG['Sources']['Source1']['DiskFile'] = '/var/log/prod/DATE.prod.log'; 



$CFG['Sources']['Source2']['ID'] = 'Source2';

$CFG['Sources']['Source2']['Name'] = 'Prod_log2';

$CFG['Sources']['Source2']['SourceType'] = 1;

$CFG['Sources']['Source2']['LogLineType'] = 'syslog';

$CFG['Sources']['Source2']['DiskFile'] = '/var/log/prod/DATE.prod.log';



$CFG['Sources']['Source3']['ID'] = 'Source3';

$CFG['Sources']['Source3']['Name'] = 'Prod_log3';

$CFG['Sources']['Source3']['SourceType'] = 1;

$CFG['Sources']['Source3']['LogLineType'] = 'syslog';

$CFG['Sources']['Source3']['DiskFile'] = '/var/log/prod/DATE.prod.log';



$CFG['Sources']['Source4']['ID'] = 'Source4';

$CFG['Sources']['Source4']['Name'] = 'Prod_log4';

$CFG['Sources']['Source4']['SourceType'] = 1;

$CFG['Sources']['Source4']['LogLineType'] = 'syslog';

$CFG['Sources']['Source4']['DiskFile'] = '/var/log/prod/DATE.prod.log';



$CFG['Sources']['Source5']['ID'] = 'Source5';

$CFG['Sources']['Source5']['Name'] = 'Prod_log5';

$CFG['Sources']['Source5']['SourceType'] = 1;

$CFG['Sources']['Source5']['LogLineType'] = 'syslog';

$CFG['Sources']['Source5']['DiskFile'] = '/var/log/prod/DATE.prod.log';



Jaysunn
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Increment userid in file

Hello, does anyone know how to increment a userid(number) written in any scripting language that works on a shell? For example: I have a HTML file in this format: userid: name: telephone: Every time I execute my script it adds the same fields, except with the userid incremented. Like... (2 Replies)
Discussion started by: dejavu88
2 Replies

2. Shell Programming and Scripting

Increment variable stored in a file

Hi, I want to write a perl script, which will increment number stored in file. I want to do this without any file handles. I think we have to use some UNIX commands. I am not sure how to do this with file handles. Thanks, (1 Reply)
Discussion started by: solitare123
1 Replies

3. Shell Programming and Scripting

Increment #'s in text file hourly

I have a text file with a number "001". I am trying to change this number every hour and increment by "1". So every hour it would add +1 to that number. I am able to change the file with sed but unable to have it increment it by "1" without me adding that to the sed command. Any help is... (23 Replies)
Discussion started by: noob33
23 Replies

4. Shell Programming and Scripting

Check file and increment

My scripts excepts 4 files ABCD_01 ABCD_02 ABCD_03 ABCD_04 I want to check for these files , and increment counter one by one . at the end i would like to echo as 4 of 4 expected instances of file found . I tried something like thsi $counter =1 if counter=counter+1 i need... (5 Replies)
Discussion started by: ultimatix
5 Replies

5. Shell Programming and Scripting

File existence and increment

count=0; while read line; do ] && let count=count+1; done < file_name.txt echo echo "$count of 10 files found " echo The scenario is a follows : I have a file which contains a list of filenames present in particular directory . I am checking fo the existence of the file and... (5 Replies)
Discussion started by: ultimatix
5 Replies

6. Shell Programming and Scripting

To increment the values from the file

Hi I have the file called "file.txt" which contains the following output $cat file.txt sandy <version>1</version> karen <version>2</version> Rob <version>3</version> peter <version>4</version> i want to write a command which will add the value 1 to the digits and show the output... (2 Replies)
Discussion started by: sidh_arth85
2 Replies

7. Shell Programming and Scripting

Increment Numbers in File

Hello, I have a text file withe some records 20121031|5 20121030|3 20121029|1 20121028|4 20121027|6 I want to search for a patten with '20121030' and then increment the second part of the delimiter i.e. 3 by 1 to make it 4 to look like 20121031|5 20121030|4 20121029|1 20121028|4... (7 Replies)
Discussion started by: pparthiv
7 Replies

8. Shell Programming and Scripting

Increment value in text file

Hi Guys, I am new to shell programing, I have a csv file which has 50k records and I have got the requirement to increment the value in second column after each 5000 records. for example below A,B,C,D //Header 1,1,London,UK 1,1,Manchester,UK 1,1,Glasgow,UK . . . 1,1,Newyork,USA... (7 Replies)
Discussion started by: rizzu1555
7 Replies

9. Shell Programming and Scripting

Need a REGEX to increment the file number of a pdf file

Hello, I have a few thousand .pdf files in various folders each have a naming scheme like this: 006_-_Titled_Document_#34_-_September-25-2011-side-1.pdf In each folder, the number system starts at 001 (as you see on the far left of the file name), and then ends at 999 (maximum .pdf files).... (4 Replies)
Discussion started by: Marcus Aurelius
4 Replies

10. Shell Programming and Scripting

Increment Column having Alphanumeric value in file

I want to replace a column(first and last) having an alphanumeric value in a file. Requirement : 1)All values in a Column must be unique and contain an incremented pattern “HCTV0096” for first column and “cafefeca0090” for last column 2)for uniquely identifying each value in column Numeric part... (6 Replies)
Discussion started by: ketanraut
6 Replies
POLYGRAPH-DNS-CFG(1)						   User Commands					      POLYGRAPH-DNS-CFG(1)

NAME
polygraph-dns-cfg - DNS server configuration tool SYNOPSIS
dns-cfg [--option ...] DESCRIPTION
Given a zone name, DNS names, and IP addresses, dns-cfg builds configuration suitable for use with BIND and, perhaps, other DNS servers. Dns-cfg output consists of three parts. The first part is the text to cut-and-paste into BIND's named.conf file. This part is sent to the standard output. The outer two parts are direct and reverse zone files. Those may be quite large and are dumped on disk into the appropri- ately named files. Dns-cfg can use PGL configuration as the source of information. OPTIONS
--help list of options --version package version info --config <filename> PGL configuration --cfg_dirs <dirs> directories for PGL #includes --zone <str> zone name --addresses <str> IP addresses --names <str> domain names COPYRIGHT
Copyright (C) 2003-2006 The Measurement Factory, Inc. SEE ALSO
polygraph(7) - general information and a list of programs http://www.web-polygraph.org/ - project web site polygraph-dns-cfg - Web Polygraph February 2010 POLYGRAPH-DNS-CFG(1)
All times are GMT -4. The time now is 05:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy