Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. learingperl01

    Saving print data to a variable

    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...
  2. learingperl01

    Readdir large number of files and mod each file

    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...
  3. learingperl01

    How to look for 2 regex and print all preciding data

    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...
  4. learingperl01

    Perl -M to check file modified time not working

    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...
  5. learingperl01

    Search for regex within a boundary

    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...
  6. learingperl01

    Clarification of system,exec,fork

    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...
  7. learingperl01

    Printing entire file when regex matches

    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...
  8. learingperl01

    Process set number of bytes at a time

    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)) {...
  9. learingperl01

    Regex only return the data that matches the regex

    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...
  10. learingperl01

    Perl Unpack function. Hex an input file

    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...
  11. learingperl01

    Print message perl number of regex matches

    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...
  12. learingperl01

    Regex match continue searching

    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...
  13. learingperl01

    Printing all output in one line

    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...
  14. learingperl01

    How to reuse the same code at different point in a script

    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...
  15. learingperl01

    How to ingore directories/files when using File:find

    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...
  16. learingperl01

    Sort md5sum output

    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...
  17. learingperl01

    How to push to an array and add a delimiter

    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...
  18. learingperl01

    How to test is a string is a multiple of 4

    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.
  19. learingperl01

    How to replace unixdate/time in a file with readable date

    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...
  20. learingperl01

    Grep once completed then move to another directory

    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...

Part and Inventory Search

Back
Top