Hello,
Can't figure out how to save something which I am currently printing to a variable.
I have to captures ()() which I am converting data in the second capture from hex
Thanks for the help.
Example:
while ( $string =~ /(capture1)(capture2)/g ) {
print "$1".chr(hex($2));
#Trying...
Hello Perl experts,
I am pretty new to Perl and having a memory problem with my code. I have narrowed it down to the following section of my code which always seems to generated the out of memory error when running.
opendir (TXT, "$processedDirPath") or die "Cannot open...
Hello everyone,
I am hoping someone can shed some light/point me in the right direction. I am trying to figure out how to search for the 1st occurrences of two strings and once they are found print all previous data.
Below is some sample data which I would be working with, any pointers etc...
Hello everyone I am not sure why using the -M to check for files modified after a certain time is not working. Regardless of what time I change the < xxx entry to I get files that don't match that time criteria. Can someone please point me in the right direction, or let me know if there is a...
Hello all,
hoping someone can help me or point me in the right direction. I have a script which I currently use but running into some problems with the output that I am getting back. I've created a new script to try to figure out the part that I am having problems which is below.
The...
Hello all I am trying to wrap my head around what the best way to call another perl script from within perl script is.
exec was my first choice as I just want to call/run the second script (call it and let is run in the BG) and not have my current script wait for the script to finish before...
Hello all I have a script that I am working on. I am trying to print the entire contents of a file when a regex match is found once instead of what $_ is holding after a match.
So if a match is found I want to stop looking and just print the entire contents of the file. I am kinda stuck as...
Hello,
I was hoping someone could point me in the right direction/help me out with the following problem.
I have the following code shown below.
#!/usr/bin/perl
use strict;
use warnings;
my $input_string = 'test';
my $hexchars = '';
foreach my $chars (split(//,$input_string)) {...
Hello perl experts, I am hoping that someone can point me in the right direction.
I am running regex matches on a file which contains alpha numeric data. I am trying to figure out how to only match or print exactly what I am searching for instead of additional data.
For example.
while...
Hello all,
pretty new to unpack function in Perl. I am trying to take an input file read it and use unpack to create a HEX output of the entire file. The only problem is that when I compare the HEX values of the file I am reading with the output of unpack some of the value are not correct...
Hello all,
I am trying to figure out how to print a message depending on the number of regexes that were matched...either the count or the number that were matched.
Example
if I am running a initial if statement with 5 regex. Depending on the number of matched regex I would like to print a...
Hello everyone, hoping someone can point me in the right direction.
I have the following code which finds files that end in .txt then tries to match on a regx. The scripts works fine, the only problem is how to I tell the script to stop the regex or print the line until a space is found. Here...
Hello I have the code below which works for the most part, the only problem that I am trying to figure out is how to get rid of the CR (return) after the use of the $data[1] variable which is splitting my output from 1 line to 2 lines.
#!/usr/bin/perl
use strict;
use warnings;
open( FILE...
Hello,
I am not the best at scripting using shell scripts, plus I am a little rusty. I am trying to figure out how to reuse the same code at two different locations in a script. For those people that know Perl like a subroutine.
For example.
I am running some a check for the day of week...
Hello I was wondering what the best way to go about ignoring directories/files that are owned by the OS/system when using File:find:name
The problem that I am running into is that there are two/three directories/files that file:find:name can't get into or that when opening a filehandle fails...
Hello,
I have the following code to generate md5sum for all files found in a directory. I was wondering how to go about sorting on the md5sum column? I tried saving to a variable then splitting on the first column then sorting but did not work. What would be the best way to sort the results...
Hello, I was wondering how to push data into an array but at the same time when pushing to an array add a '.'
for example. Variable which holds numbers
The reason I am splitting the original number when entered is because I will be running tests/other code against each one of the numbers, but...
Hello, wondering how to go about testing a string to see if it's a multiple/multiplier of 4. I want to be able to ensure that the string that I am working with is always going to be able to be divided by four if not then I would like to ignore it.
thanks for the help in advanced.
Hello,
I have the following one liner that I use to convert unixdate to a more readable date. How do I replace the unixdate/time in the actual log file with the results of the converted time?
thanks for the help
for i in `cat trd_log.txt | grep -v LOG_FOR | awk '{print $1}' |cut -d '.' -f...
Hello, I am trying to write a script to grep through a bunch of file for different words. I am having problems moving the files to another directory once my grep is done processing. How can I tell my script to only move the files once the grep is complete. Example if I am grepping for abc def...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.