I'm trying to use the following command to do a batch find and replace in all commonly named files through a file hierarchy
find . -name 'file' |xargs perl -pi -e 's/find/replace/g'
which works fine except for a substitution involving parenthesis.
As a specific example I'm trying to sub... (3 Replies)
I have korn shell script that genretaets 100 file based on template replacing the number.
The template file is as below:
$ cat template
file number: NUMBER
The shell script is as below:
$ cat gen.sh
#!/bin/ksh
i=1;
while ((i <= 100)); do
sed "s/NUMBER/$i/" template > file_${i}
((... (1 Reply)
Hi all,
Let me first start out by saying I'm a perl newbie and hope somebody can help, for the life of me I can't figure out why my script will not find and download a remote file via FTPSSL. What it's supposed to do is find the latest file named... (4 Replies)
Hi,
I am taking the current time using localtime function in perl. For example if the time is:
#Using localtime
$time = "12:3:10";
I have to replace the value 3 (03) i.e second position to be 03.
The output should be:
12:03:10
But if the other string for example:
$str:... (1 Reply)
Hi,
Please could someone advise, how I can resolve this issue with my find and replace command :
perl -i -npe "s#RLM_LICENSE.*#RLM_LICENSE=$TEAM_TOP/licenses/abc.demo.lic#;" environment.properties
$TEAM_TOP is an environment varible within my system.
when i run this perl command from... (1 Reply)
Hi,
I am stuck with an problem and want some help, what i want to do is
There is a directory name temp
which include file named t1.txt, t2,txt, t3.txt and so on.
These files contains data, but there are some bad character also that is % present in the files , I want to write the script... (13 Replies)
Hi!
I have a directory full of .plist type files from which I need to delete a line. Not every file contains the line, but of course I'd like to do it recursively. The line which I want to delete is:
<string>com.apple.PhotoBooth</string>
and looks like this in its native habitat:
... (9 Replies)
Hi,
Can somebody tell whats wrong with "find and replace perl code".
I wanted to find "\n".write(status,data" and replace with "\n",data" in multipls files.
#!/usr/bin/perl
my @files = <*.c>;
foreach $fileName (@files) {
print "$fileName\n";
my $searchStr0 =... (4 Replies)
Hello Forum.
I have a file called abc.sed with the following commands;
s/1/one/g
s/2/two/g
...
I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat
sed -f abc.sed abc.dat >... (10 Replies)
Trying to find and replace one string with another string in a file
#!/usr/bin/perl
$csd_table_path = "/file.ntab";
$find_str = '--bundle_type=021';
$repl_str = '--bundle_type=021 --target=/dev/disk1s2';
if( system("/usr/bin/perl -p -i -e 's/$find_str/$repl_str/' $csd_table_path")... (2 Replies)
Discussion started by: cillmor
2 Replies
LEARN ABOUT DEBIAN
torrus_snmpfailures
TORRUS_SNMPFAILURES(8) torrus TORRUS_SNMPFAILURES(8)NAME
snmpfailures - Displays SNMP collector failures.
SYNOPSIS
torrus snmpfailures --tree=TREENAME [options...]
OPTIONS --details
In addition to failure counters, list the failed SNMP hosts and the time stamps of failure events.
--help
Displays a help message.
DESCRIPTION
This utility prints the SNMP collector failure information in JSON format. Without --details option, it prints only the failure counters.
Upon collector startup or after the tree re-compilation, the failure counters are reset to zero.
The output is very convenient for further automatic processing in any scripting language.
The top level of the output is a JSON object with the following name/value pairs:
total_unreachable: NUMBER
Displays the number SNMP hosts that are currently unreachable. The number adds up across multiple collector instances for a given
tree. If a host becomes reachable again, the number is decreased.
total_deleted: NUMBER
Displays the number SNMP hosts that are completely removed from SNMP collection for the life cycle of the collector process. This
happens when a host is unreachable for too long time and the collector gives up to reach it again. The number adds up across multiple
collector instances for a given tree.
total_mib_errors: NUMBER
Displays the number of MIB errors (noSuchObject, noSuchInstance, and endOfMibView) during the collector life cycle. The number adds up
across multiple collector instances for a given tree.
detail_unreachable: OBJECT, detail_deleted: OBJECT
If the option --details is specified, these objects contain the host names and timestamps of the failures. The keys are
contactenations of SNMP host, UDP port, and SNMP community separated by "|". The values are objects representing the UNIX timestamp
and a human-readable time string.
detail_mib_errors: OBJECT
If the option --details is specified, this object displays the MIB error details: for each SNMP host, it lists the datasource leaves
which had these errors and the event timestamps.
EXAMPLES
The following example illustrates an SNMP host unreachable:
torrus failures --tree=main --details
{
"detail_deleted" : {},
"detail_mib_errors" : {},
"detail_unreachable" : {
"217.101.101.101|161|public" : {
"time" : "Fri Jul 23 14:15:10 2010",
"timestamp" : 1279887310
}
},
"total_deleted" : 0,
"total_mib_errors" : 0,
"total_unreachable" : 1
}
The following example illustrates a MIB error:
torrus failures --tree=main --details
{
"detail_deleted" : {},
"detail_mib_errors" : {
"217.101.102.102|161|public" : {
"count" : 1,
"nodes" : {
"/Routers/CMTS3/Temperature_Sensors/sensor_01" : {
"time" : "Fri Jul 23 15:26:14 2010",
"timestamp" : 1279891574
}
}
}
},
"detail_unreachable" : {},
"total_deleted" : 0,
"total_mib_errors" : 1,
"total_unreachable" : 0
}
SEE ALSO torrus(8),
NOTES
See more documentation at Torrus home page: http://torrus.org
AUTHOR
Stanislav Sinyagin <ssinyagin@yahoo.com>
torrus 2.03 2013-07-26 TORRUS_SNMPFAILURES(8)