I want to replace a string within a file using perl.
We have a line that gets commented out, and I want to replace that line now matter how it was commented out.
for example, I'd want to replace
###ES=PR1A with ES=PR1A
or
##LJW(9/16/26)ES=PR1A with ES=PR1A
I tried: perl... (4 Replies)
Hi using the below cmd i am identifying wheether last character in each line in thousands of files as semicolon or not.If last character is semicolon i am removing semicolon .If last character is not semicolon then i am appending next line to present line .
For example my input file consists of... (4 Replies)
I used the eval command in shell programming for assigning a value to a stored value of a variable.
Example:
VAR="Unix_Id"
eval $VAR="101"
eval echo $"$VAR"
How can i assign a value to a stored value of a variable in perl OR how i can write above code in Perl?
I need your help... (4 Replies)
Hey all, Im trying to write a script on windows, which Im not too familiar with. Im generally a bash scripting guy but am using perl for this case.
My question is...
I have this exact output:
2 Dir(s) 6,380,429,312 bytes free
and I just need to get the number out... (4 Replies)
Hi,
I have two strings like this in an array:
For example:
@a=("Brain aging is associated with a progressive imbalance between intracellular concentration of Reactive Oxygen Species","Brain aging is associated with a progressive imbalance between intracellular concentration of Reactive... (9 Replies)
Hi People,
I need some Help to write a unix script that asks for a sentence to be typed out then with the sentence. Counts the number of spaces within the sentence and then echo's out "The Number Of Spaces In The Sentence is 4" as a example
Thanks
Danielle (12 Replies)
hi everybody,
can you help me with this?
important: it has to be a pure perl code.
zz.lis:
accessibility
arabic
archivers
astro
audio
benchmarks
.
.
.
"ls accessibility | grep -v Makefile" outputs
accerciser
at-poke
at-spi
at-spi-reference (6 Replies)
Hello,
I have the following perl array:
@longname = (Fasthernet0/0 Fasthernet0/1 Serial0/1/0 Serial0/2/1 Tunnel55 Tunnel77)
with the followinh array:
@shortname = (Fa0/0 Fa0/1 Se0/1/0 Se0/2/1 Tu55 Tu77)
in other words, I need to remove the following from each element in the array... (4 Replies)
I have the following string :
Cat dog fox catepillar bear foxy
I need to replace "cat" and "fox" words from this sentence to word "animal"
I do the following:
$Str1="cat";
$Str2="fox";
$NewStr="animal";
open(F1, "<$inputFile") or die "Error: $!";
open(F2, ">$outputFile") or... (1 Reply)
Hello,
I found this Perl Script on the EuroParl website which does Sentence Splitting.
#!/usr/bin/perl -w
# Based on Preprocessor written by Philipp Koehn
binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
use FindBin qw($Bin);
use strict;
my $mydir =... (0 Replies)
Discussion started by: gimley
0 Replies
LEARN ABOUT BSD
close
CLOSE(2) System Calls Manual CLOSE(2)NAME
close - delete a descriptor
SYNOPSIS
close(d)
int d;
DESCRIPTION
The close call deletes a descriptor from the per-process object reference table. If this is the last reference to the underlying object,
then it will be deactivated. For example, on the last close of a file the current seek pointer associated with the file is lost; on the
last close of a socket(2) associated naming information and queued data are discarded; on the last close of a file holding an advisory lock
the lock is released (see further flock(2)).
A close of all of a process's descriptors is automatic on exit, but since there is a limit on the number of active descriptors per process,
close is necessary for programs that deal with many descriptors.
When a process forks (see fork(2)), all descriptors for the new child process reference the same objects as they did in the parent before
the fork. If a new process is then to be run using execve(2), the process would normally inherit these descriptors. Most of the descrip-
tors can be rearranged with dup2(2) or deleted with close before the execve is attempted, but if some of these descriptors will still be
needed if the execve fails, it is necessary to arrange for them to be closed if the execve succeeds. For this reason, the call ``fcntl(d,
F_SETFD, 1)'' is provided, which arranges that a descriptor will be closed after a successful execve; the call ``fcntl(d, F_SETFD, 0)''
restores the default, which is to not close the descriptor.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the global integer variable errno is set to
indicate the error.
ERRORS
Close will fail if:
[EBADF] D is not an active descriptor.
SEE ALSO accept(2), flock(2), open(2), pipe(2), socket(2), socketpair(2), execve(2), fcntl(2)4th Berkeley Distribution May 22, 1986 CLOSE(2)