I have a program that can be run in terminal, when its run it either returns SSH OK or CRITICAL, how do i use the output in my script?
good
./check_sh myserver
SSH OK
bad
./check_sh myserver
CRITICAL
I want to store it in a variable btw, SSH OK will give the variable $SSH=1 and if its... (1 Reply)
Hi,
i am new to awk. I am using csv2pipe script(shown below)
BEGIN { FS=SUBSEP; OFS="|" }
{
result = setcsv($0, ",")
print
}
# setcsv(str, sep) - parse CSV (MS specification) input
# str, the string to be parsed. (Most likely $0.)
# sep, the separator between the values.
#
#... (6 Replies)
Dear All:
I am trying to do something that (I thought) was relatively straightforward, but my code snippet does not seem to work.
Any suggestions?
Thank you
Sincerely yours
Misha Koshelev
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include... (0 Replies)
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
Hi All,
I am hoping someone can help me with some scripting I need to complete using AWK.
I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format.
The Input file is:-
aaaa bbbbb ccccc 1 xxxx aaa bbb
aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Hi,
I have the output (as below) which i want it to be in a table.
For e.g.
space utilization in PSE on path /logs is 0%
space utilization in PSE on path /logs/tuxedo/tuxlsp is 16%
space utilization in PSE on path /ldvarlsp/lsp/log is 37%
space utilization in PSE on path /home is 6%... (7 Replies)
Hi All,
how can i edit my original data and add more data if my 2nd script outputs SUCESS?
ex.
input file:
1.txt
nik,is,the
1script.sh
if 2ndscript.sh output SUCCESS then i'm going to edit my input file and add data best,pogi..
sample outputdata.
nik,is,the,best,pogi
2ndscript.sh... (3 Replies)
Hi Experts,
I am writing a python script to grep string from file and display output in csv file as in attached screenshot
https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view
Input file(result_EPFT_config_device)
Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies
LEARN ABOUT DEBIAN
netsds::util::file
NetSDS::Util::File(3pm) User Contributed Perl Documentation NetSDS::Util::File(3pm)NAME
NetSDS::Util::File - file related utilities
SYNOPSIS
use NetSDS::Util::File qw(file_read);
my $passwd = file_read('/etc/passwd');
file_move('/etc/passwd', '/tmp/find_this');
DESCRIPTION
"NetSDS::Util::File" module contains some routines for files and directories processing tasks like creating, reading, writing, copying and
moving files and catalogs.
This module of cource uses such well known things like File::Spec, File::Path, File::Copy and others.
EXPORTED FUNCTIONS
is_handle($var) - check if argument is a file handle
Paramters: some variable
Returns: 1 if it's file handle or undef otherwise
if (is_handle($var)) {
reset_handle($fh);
}
reset_handle($fh) - reset file handle
Paramters: file handle
Returns: nothing
This function tries to set filehandle to begin of file and set binmode on it.
my $fh = file_open('/etc/passwd');
...
do something with file
...
reset_handle($fh); # We can read it from the beginning
file_open($file) - open file
Paramters: file name or file handle
Returns: file handle
This function provides unified API for opening files.
my $f = file_open('/etc/passwd');
file_read($file) - read file to scalar
Paramters: file name or file handle
Returns: scalar content of file
This function provides ability to read file content to scalar variable.
my $data = file_read('/etc/passwd');
print "Passwords file: $data
";
file_write($file, $data) - write scalar data to file
Paramters: file name or open file handle
Returns: length of written data or undef in case of error
my $data = 'This should be file';
file_write('/tmp/file.dat', $data);
file_copy($in_file, $out_file) - copy file
Paramters: input file name, output file name
Returns:
This function copy file to new location.
file_move($in_file, $out_file) - move file
Paramters: input file name, output file name
Returns: 1 or undef
This function moves old file to new location.
file_temp($dir) - create temporary file
Creates new temp file and return its handle
dir_create($dir) - create directory with parents
Paramters: directory name
Returns: directory name or undef
# Will create all parent catalogs if necessary
dir_create('/var/log/NetSDS/xxx');
dir_delete($dir) - remove directory recursive
Paramters: directory name
Returns: dir name or undef if error
print "We need no libs!";
dir_delete('/usr/lib');
dir_read($dir, $ext) - read files list from catalog
Paramters: directory name, extension of files to read
Returns: list of files in catalog
my @logs = @{ dir_read('/var/log/httpd', 'log') };
print "Logs are: " . join (', ', @logs);
dir_read_recursive($dir, $ext, [$res]) - read all files list recursive
Paramters: $start catalog, $extension
Returns: list of files with extension from parameters
my $tpls = dir_read_recursive('/etc/NetSDS', 'tmpl');
foreach my $tpl (@$tpls) {
pritn "Template: $tpl
";
}
exec_external($prog, [$param1, ... $paramN]) - execute external program
Paramters: pragram name, arguments list (see perldoc -f system)
Returns: 1 if ok, undef otherwise
This function calls system() with given parameters and returns 1 if everything happened correctly (program executed and returned
correct result).
if (exec_external('/bin/rm', '-rf', '/')) {
print "Hey! We removed the world!";
}
EXAMPLES
None yet
BUGS
Unknown yet
SEE ALSO
IO::Handle, IO::Scalar, IO::File, File::Spec, File::Copy, File::Path, system()
TODO
1. Implement more detailed error handling
AUTHOR
Valentyn Solomko <pere@pere.org.ua>
Michael Bochkaryov <misha@rattler.kiev.ua>
perl v5.12.4 2011-08-27 NetSDS::Util::File(3pm)