Shell Script to Search for a particular String and copy the timestamp to a variable
Hi,
We Perfrom Loads to the database through a Perl script which generates a statistics file. I need to read the statistics. the Statistics file looks something like below:
There are many instance like the above in a single file.I am able to open the file and read line by line. But, my requirement is to read the Process Beginning, INSERTED ROW COUNT: and Process Complete into three variables. The count should keep on adding between a process.
can anyone please help me with this?
Last edited by Praveenkulkarni; 09-02-2010 at 01:48 PM..
Reason: Code tags, please!
Hi,
I've a shell script e.g.
#!/bin/bash
echo "Enter the next hop id"
read nhid
echo "enter the IP address"
read IP
echo "enter the interface name"
read name
echo "enter the enable/disable state"
read state
exit 0
now from this script i want to search strings in another (.cam)
... (6 Replies)
Compete noob question....
I need a script to search through a directory and find files containing text string abcde1234 for example and then copy that file with that text string to another directory
help please :eek: (9 Replies)
Hi, guys. I have one question:
I need to search for a string in a file, and then extract another string from the file and assign it to a variable.
For example:
the contents of the file (group) is below:
...
ftp:x:23:
mail:x:34
...
testing:x:2001
sales:x:2002
development:x:2003
...... (6 Replies)
Hello All,
I am after the script or the command which can scan the entire file for a string $PART_ID and when found to extract/copy the corresponding $PART_ID value (e.g THIRE_PTY_SOFTWARE for the 1st occurance of $PART_ID in the attached file) to a file.
Appreciate your help.
Thanks in... (3 Replies)
Hello
Im new to this forums, I would like some help regarding a script that I need in order to copy some files. Heres the scenario:
I need to search several files which have a particular code inside, lets say "test" all of them on different directories. I need to copy all of them on a new... (4 Replies)
Hi All,
I am trying to to compare a string variable with a string literal inside a loop but keep getting the
./testifstructure.sh: line 6:
#!/bin/sh
BOOK_LIST="BOOK1 BOOK2"
for BOOK in ${BOOK_LIST}
do
if
then echo '1'
else
echo '2'
fi
done
Please use next... (1 Reply)
Hi folks,
I am new for shell script, I hope somebody to help me to write shell script
My requirement is below steps
1. I have apache access.log i.e located in /var/log/httpd/
Ex.
127.0.0.1 - - "GET... (14 Replies)
Hello All
I have a pattern.txt file in source directory ((/project/source/) in linux server and data looks like:
123abc17
234cdf19
235ifg20
I have multiple log files in log directory (/project/log/) in linux server and data for one log file looks like:
<?xml version="1.0" processid... (11 Replies)
So, there is a large file where I have to conduct several search using bash shell scripting.
The file is like this:
TITLE and AUTHOR ETEXT NO. Aspects of plant life; with special reference to the British flora, 56900 by Robert Lloyd... (1 Reply)
I have a text file which is generated when the batch job is run. This batch may take few mins to run. When completed, the last line of the text file would be process completed. I need a shell script which will wait for this file till the process completed is printed in it, once found, it would move... (2 Replies)
Discussion started by: Lalat
2 Replies
LEARN ABOUT DEBIAN
sys::statistics::linux::pgswstats
Sys::Statistics::Linux::PgSwStats(3pm) User Contributed Perl Documentation Sys::Statistics::Linux::PgSwStats(3pm)NAME
Sys::Statistics::Linux::PgSwStats - Collect linux paging and swapping statistics.
SYNOPSIS
use Sys::Statistics::Linux::PgSwStats;
my $lxs = Sys::Statistics::Linux::PgSwStats->new;
$lxs->init;
sleep 1;
my $stat = $lxs->get;
Or
my $lxs = Sys::Statistics::Linux::PgSwStats->new(initfile => $file);
$lxs->init;
my $stat = $lxs->get;
DESCRIPTION
Sys::Statistics::Linux::PgSwStats gathers paging and swapping statistics from the virtual /proc filesystem (procfs).
For more information read the documentation of the front-end module Sys::Statistics::Linux.
PAGING AND SWAPPING STATISTICS
Generated by /proc/stat or /proc/vmstat.
pgpgin - Number of pages the system has paged in from disk per second.
pgpgout - Number of pages the system has paged out to disk per second.
pswpin - Number of pages the system has swapped in from disk per second.
pswpout - Number of pages the system has swapped out to disk per second.
The following statistics are only available by kernels from 2.6.
pgfault - Number of page faults the system has made per second (minor + major).
pgmajfault - Number of major faults per second the system required loading a memory page from disk.
METHODS
new()
Call "new()" to create a new object.
my $lxs = Sys::Statistics::Linux::PgSwStats->new;
Maybe you want to store/load the initial statistics to/from a file:
my $lxs = Sys::Statistics::Linux::PgSwStats->new(initfile => '/tmp/pgswstats.yml');
If you set "initfile" it's not necessary to call sleep before "get()".
It's also possible to set the path to the proc filesystem.
Sys::Statistics::Linux::PgSwStats->new(
files => {
# This is the default
path => '/proc',
stat => 'stat',
vmstat => 'vmstat',
}
);
init()
Call "init()" to initialize the statistics.
$lxs->init;
get()
Call "get()" to get the statistics. "get()" returns the statistics as a hash reference.
my $stat = $lxs->get;
raw()
Get raw values.
EXPORTS
No exports.
SEE ALSO proc(5)REPORTING BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
COPYRIGHT
Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-03-09 Sys::Statistics::Linux::PgSwStats(3pm)