All Questions
66
questions
2
votes
1
answer
396
views
How can I pass variables from a Perl script to a Bash script?
I got the duty to make a fix to an ancient Perl script our company uses, I haven't even looked at Perl in about 20 years. So I want to pick up a couple of the variables, and dump them to the ...
1
vote
1
answer
121
views
If loop not working as intended for perl scrpt
I'm trying to create a Perl script that automatically check for changes in a data.list every hour, username/project/tota/datas/data.list is where the file is and then execute the remaining codes, ...
-1
votes
3
answers
970
views
perl - how to convert hh:mm:ss to seconds
Is there a way in perl to convert a duration (hh:mm:ss) to total number of seconds?
sample: 02:50:30
output: 10230
-3
votes
1
answer
46
views
Perl having problem in programme execution [closed]
#!/usr/bin/perl
#Script:name2.pl - Demonstrates use of chop
#
print("Enter your name:");
$name=<STDIN>;
$lname = chop($name); #Removes newline character from $name
...
1
vote
1
answer
79
views
(perl) Rename bulk files - moving section starting with #{NUMBER} to front
I am trying to rename many files with the example formatting using rename with perl scripting
'Balisong Tutorial - (0g Chaplin) - Advanced #21-d8ajkHL34s0.mkv'
'Balisong Tutorial - (ALT Reverse Behind ...
0
votes
1
answer
3k
views
No recipient addresses found in header - Sendmail [closed]
From C shell script I am invoking a perl script to send an email,
/path/send/email/email.pl "[email protected]" | /usr/sbin/sendmail -t
Perl script
print "To: ".$ARGV[0]."\n&...
0
votes
2
answers
1k
views
How to check if 2 files are empty in perl using if condition
if(-z "$file1" && "file2") {
print "file1 and file2 are empty";
} else {
print "execute";
}
When I write this, when the files are empty it prints ...
1
vote
2
answers
77
views
Remove duplicates csv based on first value keeping the longest line between duplicates
I have many different csv files in a folder (megadrive.txt, snes.txt) like this:
Aerial Assault (USA);Aerial Assault (USA);Sega Master System;;;;;;;;;0;;;;;
Aerial Assault (USA);Aerial Assault (USA);...
0
votes
1
answer
52
views
Cutting out specific text from specific lines in real time
So I have a log running in real time and saving to a text file named 'test.txt' also in real time. Now I want to set up a process that constantly polls that text file for changes and cuts out a ...
-1
votes
2
answers
65
views
Perl::Find a substring and display a whole word
I have a text file that has some data like:
PADHOGOA1 IOP055_VINREG5_1 ( .IO(VINREG5_1), .MONI(),
.MON_D(px_IOP055_VINREG5_1_MON_D), .R0T(px_IOP054_VINREG5_0_R0T),
.IO1() );
PADV30MA0 ...
1
vote
3
answers
751
views
Perl: Inserting at nth position in file
I have content in my file :
123456789
My output is:
1234CC789
Desired Output is:
1234CC56789
I am insert PP at nth position suppose.
But when I am inserting any text it is inserting the text at ...
0
votes
2
answers
587
views
REGEX: flush a number of related chains in iptables
I want to flush a number of related chains in IPtables. Their names like 'f2b.*'
I want the entire chain gone!
e.g. all this gone.
-A f2b-postfix-sasl -s 103.231.139.130/32 -j REJECT --reject-with ...
0
votes
1
answer
53
views
Split and store in Perl
I have a file with this content:
Ref BBPin r:/WORK/M375FS/HMLSBLK4BIT0P0_0/LSVCC15
Impl BBPin i:/WORK/M375FS/HMLSBLK4BIT0P0_0/LSVCC15
Ref BBPin r:/WORK/HMLSBLK4BIT0P0_0/LSVCC3
Impl ...
0
votes
2
answers
137
views
Returning wrong results in perl script [duplicate]
I am running this command on linux shell it works smoothly
sed -i 's/\[-.*-]//g' error .txt
What it does is it removes patterns like [-any text-] along with the brackets and - sign.
but when I try ...
0
votes
3
answers
2k
views
perl regex - How to match foobar that does not begin with (\s*//\s*)
Basically I want to find foobar on uncommented lines like:
// foobar # do not match me
foobar # match me
otherfoobar # do not match me
To match the commented lines I use this: ^(\s*//...