Just a few quick questions for you Jim.
1. In this statement "foreach my $search ( @SEARCH )", Does the statement dynamically create an "internal" array that it then uses to reference? I am not sure of the process here so I would like to know if you get a moment.
2. In the following statment...
That was it! Thanks for all your help on that Jim. I really appreciate it. I hope through practice I'll be able to return the favour someday.
Thanks again.
Geek.
Jim,
I noticed that if I put the following print statement after the unpack function:
print "$names\t";
I get a page full of the second unpack variable. The records in this are all without the trailing blanks. Wouldn't that mean that Unpack is doing that?
Geek.
Jim,
Thanks for that code change. It is so small and easy with what you have done. I tried it out and still am having the same problem. The values I want erased are going away, but when I print the record back out, the 2nd upack function "names" is dropping the blanks off the end of that...
That code upgrade is great. Thanks for making it a lot more concise. I am pretty new to Perl as I am sure you can tell, but this helps a lot to learn. I know I need to learn "hashing" but basically the contents of the search and replace arrays are the following:
Search is:
my @SEARCH = ("...
Thanks Jim for your quick response. Here is the code I am using. Actually in my previous post I made a mistake and said the "end" has the blanks, but the blanks are actually in the "names" record. Could it be the actual search and replace that is causing the blanks to vanish? If you have any...
The problem I am having with the UNPACK function is the following:
I am currently unpacking a record of 220 bytes into 3 variables. The first is to be left untouched, the second has some search and replace stuff going on in it, and the third is untouched. When I print out the results after...
Hi.
The subject may be a bit odd, but what I want to do is create a cron job that will run every evening on the hour from 7pm till 2am. The job will go out and get a file from our server and check this file against counts that already exist on our current machine. If the file matches the...
This is a pretty simple question, but one that I can't seem to find a quick answer for. So I thought maybe someone on this board might be able to help me out. Basically I am using VI to look at a file with 10 records in it. With my cursor on the last character of the record, I hit the...
Hi,
I am trying to figure out how I can successfully SFTP a file from within a shell script. Currently we do a few things with FTP within a shell script, but we are in the process of changing this. Can someone point me to a good way that I might be able to do the same thing with SFTP...
Vlad,
Thanks for the support. I don't know why I am getting the negative with the first way, but when I try the alternative way you mentioned, it worked fine. What does it mean when you pipe it to "bc". I understand it has to do with arithmetic conversions, but I don't fully...
Hello,
I am currently writing a script to print a report after collecting a bunch of information on our servers. The report is looking fine except for 1 thing. There are about 3 spots on the report that the number comes out negative. I tried running the command on the command line and I still...
There are 8 records with that character length. The "\n" is the 1313th character. Is this the problem? The file is a Text file and also I am working on Linux, but have not tried it on Windows.
Geek.
Hello,
I am trying to use the length function to determine the length of the input string and then print it if it is 1313 long. Else just skip it. This is what I have so far. I am not sure what I am doing wrong. Any help would be great.
#!/bin/ksh/perl -w
use strict;
##Open file for...
I am trying to open a file and then access each line and then enter that line into the "n"th position of an array. I am not sure how to do this. I am pretty new to perl, and would love some help. Here is my small code snippet. What could I do so I can take the undefined length of...
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.