Sponsored Content
Top Forums Shell Programming and Scripting SOLVED: reading config file in a perl script Post 302447847 by namishtiwari on Tuesday 24th of August 2010 12:59:20 PM
Old 08-24-2010
Code:
#!/usr/bin/perl

use strict;
use warnings;
use LWP::Simple;
my $filename="data.txt";
open(FILE, $filename) or die ("could not open $filename!") ;
while (my $data = <FILE>)
{
	chomp $data;
	my $status = getstore($data,my $file1);
	print "The status of the URL $data  is $status\n"	
}
close (FILE);

the data.txt file contains the url list.

Thanks
Namish
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading each line of a file in perl script

HI I need to read each line (test.txt) and store it in a array (@test) How to do it in perl. Suppose i have a file test.txt. I have to read each line of the test.txt file and store it in a array @test. How to do it in perl. Regards Harikrishna (3 Replies)
Discussion started by: Harikrishna
3 Replies

2. Shell Programming and Scripting

Help with perl script while reading a file

Hi Everyone, I am very new to perl, but came across a situation wherein I have to read a c++ header file and write the datatype, its identifier and also the length to an excel file. There can be other header files, in the directory but I should browse through the file which has only "_mef:" string... (9 Replies)
Discussion started by: ramakanth_burra
9 Replies

3. Shell Programming and Scripting

Help need in perl script reading from file

Need perl script, data file will be csv format. I have text file contains 2 colums. Filename Foldernumber aaaa 13455 bbbb 23465 cccc 26689 I have two location 1. files present and 2. folders present. I need to search for file and folder if folder... (3 Replies)
Discussion started by: hnkumar
3 Replies

4. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

5. Shell Programming and Scripting

[Solved] perl and grep: get a script to look at more then one file

hi guys i have this very messy script, that looks in /var/log/messages.all for an error and reports if it finds the key works how can i get it to look at more then one file, i.e /var/log/message.all * so it looks in old logs as well thanks exit 0 if (isRenderNode(hostname)); my... (4 Replies)
Discussion started by: ab52
4 Replies

6. Shell Programming and Scripting

Perl Script for reading table format data from file.

Hi, i need a perl script which reads the file, content is given below. and output in new file. TARGET DRIVE IO1 IO2 IO3 IO4 IO5 ------------ --------- --------- --------- --------- --------- 0a.1.8 266 236 ... (3 Replies)
Discussion started by: asak
3 Replies

7. Shell Programming and Scripting

[Solved] Get username, etc. from config file

how can i get the database name from a config file its like this: // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'userabc_wrdp1'); (there might be spaces in the front of "define") i want to store... (0 Replies)
Discussion started by: vanessafan99
0 Replies

8. Shell Programming and Scripting

[Solved] Reading the last word in a file from a script

Hello everybody, My first time here and my english is not very good I hope you understand me. I'm trying to read a file that contains two zip archive names. Here my file content is: package1.zip package2.zip At the end of the line there is a \n character. I read this file from a... (2 Replies)
Discussion started by: Aurea
2 Replies

9. Shell Programming and Scripting

Need help with perl script with a while loop reading file

Good morning, I appreciate any assistance that I can get from the monks out there. I am able to get this to work for me so that I can do a hostname lookup if I only specify one hostname in the script. What I want to do is have a file with hostnames and do lookups for each name in the file. Here is... (1 Reply)
Discussion started by: brianjb
1 Replies

10. Shell Programming and Scripting

Error while reading variable from a file in perl script

I have a file abc.ini and declared many variables in that file, one of the variable(DBname) value I am trying to read in my perl script but getting error. File abc.ini content # database name DBname =UATBOX my $ex_stat; my $cmd_output; $ex_stat = "\Qawk '/^DBname/{print... (2 Replies)
Discussion started by: Devesh5683
2 Replies
MAKESH(1)                                                     General Commands Manual                                                    MAKESH(1)

NAME
makeSH - a .SH script maker SYNOPSIS
makeSH files DESCRIPTION
MakeSH examines one or more scripts and produces a .SH file that, when run under sh, will produce the original script. The .SH script so produced has two sections containing code destined for the output. The first section has variable substitutions performed on it (taking values from config.sh), while the second section does not. MakeSH does not know which variables you want to have substituted, so it puts the whole script into the second section. It's up to you to insert any variable substitutions in the first section for any values you want from config.sh. You should run makeSH from within your top-level directory and use the relative path to the file as an argument, so that the "Extracting ..." line printed while running the produced .SH file later on will give that same path. AUTHOR
Larry Wall <lwall@netlabs.com> SEE ALSO
pat(1), metaconfig(1), makedist(1). BUGS
It could assume that variables from metaconfig's Glossary need to be initialized in the first section, but I'm too lazy to make it do that. LOCAL MAKESH(1)
All times are GMT -4. The time now is 03:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy