How to use perl to generate files with correct filenames?
Hi,
I'm trying to use perl to generate files based on sections in a large textfile.
This will create one file per section that starts with " ABC_":
However, the output filenames will be on the form output_nn. This is not the way I would like it.
The text ABC_ that indicates the start of my block is first letters of a unique word (like ABC_asdf, ABC_qwer, ABC_fdsaqwe, etc). I would like this word to be my output file names, so that the files would be named ABC_asdf, ABC_qwer, ABC_fdsaqwe, etc.
How may I change my "script" to support this?
Thanks to anyone that might be willing to help me out here
Problem: I have a shell script that will be called by a Perl module that will connect to a db and delete rows. The Perl module will be called by CRON. I am using a Perl module to call a shell script because I need to get the db connection from Perl.
Here is the Perl pseudocode:
... (4 Replies)
Hi,
I need to write a perl script that should do a search recursively in all the '*.txt' files for the string "ALL -Tcb" and should print only the file names that do not contain this string. (21 Replies)
Hi,
How to get correct IP address of a system?
I tried using this but i didn't get exact output.
Here is the code:
$host = $ENV{'REMOTE_HOST'};
print "<br> host ip address ---> $host <br>";
$addr = $ENV{'REMOTE_ADDR'};
print "<br> host address ----- > $addr <br>";
But i am... (4 Replies)
Hi
I have 2 directories t1 and t2 with some files in it. I have to see whether the files present in t1 is also there in t2 or not. Currently, both the directories contain the same files as shown below:
$ABC.TXT
def.txt
Now, when I run the below script, it tells def.txt is found,... (5 Replies)
I have a perl find program that will find all files of window application stored on unix disks.
Ofcourse these files contain all the weird characters windows allows, but on *nix pukes out all kinds of unwanted effects when processing these.
Is their a utility that will escape all these... (3 Replies)
Hi all,
I want to generate output files in a loop, run the same command on the same input file 1000 times and output in files with a new name each time, maybe a number appended to it. The output will be different each time as I`m sampling randomly from the input file.
I want to do the... (3 Replies)
We have the data looks like below in a log file.
I want to generat files based on the string between two hash(#) symbol like below
Source:
#ext1#test1.tale2 drop
#ext1#test11.tale21 drop
#ext1#test123.tale21 drop
#ext2#test1.tale21 drop
#ext2#test12.tale21 drop
#ext3#test11.tale21 drop... (5 Replies)