Hi all,
Just two quick questions about writting some scripts.
The script I am writting has to be able to add users. Well I can work out the commands I need to put in for the user to be added. But how would I need to do to set the password for that user. Keeping in mind the script will be run... (1 Reply)
Hi All,
I have a very typical problem and need you guys help
I was about to modify the content inside one shell script (sample.sh) and before doing this i took a backup of it. But the problem is this script didn't get any issue but while creating the new script i have given this content and... (1 Reply)
Hello. I'm here again.
I have a script in python and bash, and I need execute this script over all files in all folders.
Example:
Folder: CMDB
Subfolders: router1
router2
switch1
switch2
and in this folders exists a file called... (3 Replies)
This may be a question for a different forum, but as I will need a script I thought I would start here.
We recently migrated from Solaris 8 to Solaris 10. The file system in question here is ZFS, meaning the method for listing and applying ACL's has changed dramatically. To make a long story... (3 Replies)
1.) I am to write scripts that will be phasetest folder in the home directory.
2.) The folder should have a set-up,phase and display files
I have written a small script which i used to check for the existing users and their password.
What I need help with:
I have a set of questions in a... (19 Replies)
Hello everyone!!
I am not completely new to shell script but I havent been able to find the answer to my problem and I'm sure there are some smart brains here up for the challenge :D.
I have several CSV files that I need to combine into one, but I also need to know where each row came from.... (7 Replies)
Hi !!
I'm rather new both to the UNIX and scripting worlds, and I'm learning the ropes of scripting. Having said this, please excuse me if you notice certain basic errors.
I'm working on a script that implements .jar and .war files for a WAS environment and I need to perform certain... (4 Replies)
I have a .csv file and I want to md5 hash the second column for each row in the file.
File is something like
data1,foobar1,123,345
data2,foobar2,456,9393
data3,foobar3,1002,10109
Output would be like
data1,6c81243028f8e455fa617dd5f0232ce1,123,345... (3 Replies)
Hi everyone,
I have a situation in which I have multiple (3 at last count) date columns in a CSV file (, delim), which need to be changed from:
January 1 2017 (note, no comma after day)
to:
YYYY-MM-DD
So far, I am able to convert a date using:
date --date="January 12, 1990" +%Y-%m-%d
... (7 Replies)
Hello,
I have a requirement to apply hashing algorithm on flat file on one or more columns dynamically based on header
sample input file
ID|NAME|AGE|GENDER
10|ABC|30|M
20|DEF|20|F
say if i want multiple columns based on the header example id,name or id,age or name,gender and hash and... (13 Replies)
Discussion started by: mkathi
13 Replies
LEARN ABOUT DEBIAN
io::file
IO::File(3perl) Perl Programmers Reference Guide IO::File(3perl)NAME
IO::File - supply object methods for filehandles
SYNOPSIS
use IO::File;
$fh = IO::File->new();
if ($fh->open("< file")) {
print <$fh>;
$fh->close;
}
$fh = IO::File->new("> file");
if (defined $fh) {
print $fh "bar
";
$fh->close;
}
$fh = IO::File->new("file", "r");
if (defined $fh) {
print <$fh>;
undef $fh; # automatically closes the file
}
$fh = IO::File->new("file", O_WRONLY|O_APPEND);
if (defined $fh) {
print $fh "corge
";
$pos = $fh->getpos;
$fh->setpos($pos);
undef $fh; # automatically closes the file
}
autoflush STDOUT 1;
DESCRIPTION
"IO::File" inherits from "IO::Handle" and "IO::Seekable". It extends these classes with methods that are specific to file handles.
CONSTRUCTOR
new ( FILENAME [,MODE [,PERMS]] )
Creates an "IO::File". If it receives any parameters, they are passed to the method "open"; if the open fails, the object is
destroyed. Otherwise, it is returned to the caller.
new_tmpfile
Creates an "IO::File" opened for read/write on a newly created temporary file. On systems where this is possible, the temporary file
is anonymous (i.e. it is unlinked after creation, but held open). If the temporary file cannot be created or opened, the "IO::File"
object is destroyed. Otherwise, it is returned to the caller.
METHODS
open( FILENAME [,MODE [,PERMS]] )
open( FILENAME, IOLAYERS )
"open" accepts one, two or three parameters. With one parameter, it is just a front end for the built-in "open" function. With two or
three parameters, the first parameter is a filename that may include whitespace or other special characters, and the second parameter
is the open mode, optionally followed by a file permission value.
If "IO::File::open" receives a Perl mode string (">", "+<", etc.) or an ANSI C fopen() mode string ("w", "r+", etc.), it uses the
basic Perl "open" operator (but protects any special characters).
If "IO::File::open" is given a numeric mode, it passes that mode and the optional permissions value to the Perl "sysopen" operator.
The permissions default to 0666.
If "IO::File::open" is given a mode that includes the ":" character, it passes all the three arguments to the three-argument "open"
operator.
For convenience, "IO::File" exports the O_XXX constants from the Fcntl module, if this module is available.
binmode( [LAYER] )
"binmode" sets "binmode" on the underlying "IO" object, as documented in "perldoc -f binmode".
"binmode" accepts one optional parameter, which is the layer to be passed on to the "binmode" call.
NOTE
Some operating systems may perform "IO::File::new()" or "IO::File::open()" on a directory without errors. This behavior is not portable
and not suggested for use. Using "opendir()" and "readdir()" or "IO::Dir" are suggested instead.
SEE ALSO
perlfunc, "I/O Operators" in perlop, IO::Handle, IO::Seekable, IO::Dir
HISTORY
Derived from FileHandle.pm by Graham Barr <gbarr@pobox.com>.
perl v5.14.2 2011-09-19 IO::File(3perl)