Perl - Shell Scripts

The usefulness of perl is not very much exploited by windows users. I wish I could change that by my scripts. For these scripts to work, get ActivePerl if you are a Windows user. If you use perl, just run these scripts at the console with the command 'perl <filename>'. All the given scripts are free for you to copy, distribute, modify or any other thing that comes to your mind.

These scripts that I have provided here are made by me and used with the Active Perl compiler. I made the first two to aid me in organizing many html files. They may not be much help for you as it is, but you can use them after modifications.

SeekAndExtract Vs 1.00.B
For extracting content from HTML files from a user specified string to another user specifed string and save them as a txt file. Useful if you have a lot of html files you need to convert to text files.
LineRename V 1.00.A
Renames all the text files in a folder to their respective first lines. If there are blank lines, it clears the file of all blank lines. I don't see how you can use this program to fit your perpose, but I made it when I had a lot of small poems in text files. I used this program to give the poem's files names.
HTMLViewer V 1.02.A
This is a offline HTML file viewer for DOS. Run the script with the html file in the command line. For best results, use the Batch file 'html.bat
 



I have made more Shell Scripts, but I don't know whether the visitors of this web can use it. As a result, I have not uploaded it. All my scripts are listed here - just the name and a small description, no script. If any one is intrested in any script, please let me know and I will upload the specified program.

record analyser1.00.A
This script analyses the 'Record.txt' file made by the Boot Boster program and show the results in a graphical format. This script will give you a graphical break down of all your boots. It compare the hits in Morning and Evening, in the different hours of the day, and in all the months. It will display the results in a very detailed and attractive graphical form.
DigitAchiveSearcher2.00.C
A perl script to search the Digit magazines data base of previous issues.
Rediff Virus Remover1.00.A
This was created to to remove the RediffBol virus from HTML Files.
 


Formatering
1st Impression Formater1.00.A
This script will convert BootRecorder format of one line jokes to 1st Impression Format. Will space words according to the screen space.
ReNamer1.00.A
For extracting one specific line from HTML files from '$search_string' to '$end_string' and give the file that line as its name.
ExtractnNamer1.00.A
This will expract a specified line(specified as a regular expression) and then give it as the name of the file.
LineExtracter1.00.A
Copies all lines in the file "$file" with the text "$search" in them to a new user specifed file and all the lines without that text to another file


HTML Helpers
Linked File Mover1.00.A
This will move all the files linked in a html file to a new user defined folder.
HttpToFile1.04.A
This will correct the links of all the html files within a folder. The html files must be taken from the internet thru IE's save function. This will also corrects the image links, script links and style sheet links.


MP3 CD Indexer
M3U Collector1.01.A
Input a winamp playlist of a MP3 CD and this script will analyze it and save the results to a Database that can be searched with the Searcher script.
M3U Searcher1.00.A
Searchs a Database that is created by the M3U collector for a user specified song or artist.


Some CGI Scripts are also available...

Comments

Juno at 07 Mar, 2007 05:20
Hi,

Looks like u might be able to help me.
I have .pag files that i need to be converted to .txt files.
This has to happen for all the files under all folders and subfolders.

For Eg: Lets consider a folder structure in a unix box : data/year/org1/org2/org3 ....
The script must be able to create the same folder structure in another location and convert all the .pag files to .txt retaining their respective folders.
i.e, if a file "test.pag" in the folder /data/year/ in the unix box , i have to convert tthe test.pag to test.txt and put it in the other location /data/year/.

I hope i make sense.
If you can .. pls do help .. its urgent.

Thanks,
Juno

Reply to this.
Binny V A at 08 Mar, 2007 05:46
Just copy the entire folder to another folder. Now in the new folder run this command...
find . -name "*.pag" -exec rename .pag .txt {} ;

I am assuming you have a unix box - if its a windows machine, this will be much harder.
Reply to this.
Amit at 18 May, 2007 07:24
Hello,

I have similar reqmt like your LineExtracter script. I need to filter the lines based on the search to a new file. That will be much help if you can upload this script.

Thanks,
Amit
Reply to this.
Anonymous at 23 Jun, 2007 05:34
how to run a cgi script by using perl.
regards,
senthil,
Reply to this.
Binny V A at 23 Jun, 2007 09:21
Install Perl. Then at the command line run the command 'perl [file.cgi]'

Thats all.
Reply to this.
Anonymous - Boston at 11 Jul, 2007 05:26
Hi,

I have a perl script that I need to run either as a bat file or an exe, we are a windows shop and I am trying to get an old report I had that ran on Linix to work here at my new shop that has windows. Is there an easy way to convert the perl script to a bat file or exe?
Reply to this.
Binny V A at 11 Jul, 2007 02:35
A much better and easier method is to install Perl in Windows. You can get the windows port of Perl - it is called ActivePerl.
Reply to this.
Shivangi Agrawal at 16 Jul, 2007 03:16
Hi,

I have an output file like this:
080480-8108000 r-xp 0000 /delsoft/PbdProfiler/SPYGLASS_HOME/obj/check.Linux2
b06fa0-b07040 r-xp 00000 /delsoft/tcl_perl_interface/arch/auto/Tcl/Tcl.so
b06fa0-b07040 r-xp 00000 /delsoft/tcl_perl/arch/auto/Tcl/Tcl.so

and so on....

I need to print only the first column and the last column using Hashes of Arrays.........

So i need help in this regard.

Thanks and Regards,

Shivangi
Reply to this.
Anonymous at 03 Sep, 2007 11:49
Hi Please send me the Shell scripts . What ever you have return . I have a good exposure in shell scripting therotically. If U have send the shell scripts then i can work on it and can gain som practical Exposure too

Please do the needful
Venki
Reply to this.
rda at 10 Oct, 2007 11:54
Hello,

I need a Perl script to apply a regular expression on a text file and return the match. I use the applescript command do shell script" perl -e . I am new to perl, co these example could be usefull...

Thanks in advance...

Rda
Reply to this.
Anonymous at 31 Oct, 2007 09:11
Hi I am Linux administrator from Rajkot Gujrat India
Reply to this.
Anonymous at 23 Jan, 2008 10:17
#!/usr/local/bin/perl
$reportname=$ARGV[0];
$count=$ARGV[1];
#print "$reportname$count";
$FILE_NAME="$ENV{AI_SERIAL_LOOKUP}/fwore_file_time.dat";
#print "$FILE_NAME";
open(DAT, $FILE_NAME)|| die("Could not open file!");
@raw_data=<DAT>;
close(DAT);
foreach $record (@raw_data)
{
@test_array=split /,/, $record;
$array_size=@test_array;
$test_string="";
if (lc($reportname) eq lc($test_array[0]))
{
if($count == $test_array[1])
{print"0";}
else
{
$i=2;
while($i <= $array_size)
{
$test_roc_string="$test_roc_string, $test_array[$i]";
$i=$i+1;
}
$test_roc_string = substr($test_roc_string, 2, length($test_roc_string)-6);
if (lc($reportname) eq 'apecs')
{
print"For APCES source, we are expecting 2 files.";
}
else
{
print"For report $reportname, we are expecting files from the following ROCs: $test_roc_string";
}
}
}
}
Reply to this.
Anonymous at 19 Jun, 2008 03:14
Hie, I am currently a perl student, I need to write a perl program that analyses text files to obtain statistics on their content, will be grateful if you can assist.
Reply to this.
Anonymous at 18 Aug, 2008 10:08
Dear All,

I am a new bie in perl. I have to generate LDIF files after reading a file containing a list of userids of a new admitted batch of a university along with their passwords, uidNUmber And gidNumber. Say the new batch contains 400 students, and the uidNumber starts from the number 2631 onwards. So for each new userid read from the file (it contains the userids and their respective MD5 password), a new LDIF file has to be generated. The LDIF file format for a student is :-



dn: uid=s08-1-5-097,ou=student,dc=nits,dc=ac,dc=in
uid: s08-1-5-097
cn: s08-1-5-097
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}$1$2P6e6UmE$ZewMWmNBQ0ghQ9l/OK0Ft/
loginShell: /bin/bash
uidNumber: 2631
gidNumber: 2631
homeDirectory: /mnt/btech/s08-1-5-097
shadowLastChange:13458
shadowMin: 0
shadowMax: 999999
shadowWarning: 7



1)
Here the lines which should be updated are the first line, where the uid=uid=s08-1-5-097, is to be filled up for every new uid read from the input file.

2)

The second line is to be updated with the uid read from the input file.

3)

The third line is to be updated with the uid for value of cn:



4)

Lines 4-7 are not to be changed for anything. They would remain same as shown above.

5)

The line 8's userPassword has to be updated after the MD5 passoword corresponding to each uid.

6)

Line 6 would remain same for all the files. Nothing to be changed.

7)

uidNumber and gidNumber would be same for a stundent and should be incremented for the nest file.


8)

The home directory should be as: /mnt/btech/value of uid

where the uid's value is read from the input file, for example it is here->s08-1-5-097

for all the files it would be different as uid is different for each student. This would be their home directory.

9) The lines below the line of homedirectory would remain same for all the files.

Please provide me the perl script for that. I am just a new bie and would take weeks to write the script for doing that.

A sample student file of five students is as given below (in the format of uid, MD5 password) as below:-



s08-1-5-093 $1$2P6e6UmE$X71iU1QF6it6oxalIPqMS/
s08-1-5-094 $1$2P6e6UmE$R37ySEfe5JPjRTmdIo2xf.
s08-1-5-095 $1$2P6e6UmE$VKlXe6lSoXr4aWBmuSn6u/
s08-1-5-096 $1$2P6e6UmE$H7Q3Thg4KQKeuAvOsffp8.
s08-1-5-097 $1$2P6e6UmE$ZewMWmNBQ0ghQ9l/OK0Ft/


Now please generate five LDIF files in the format as shown above for each uid after redaing fro the input file of five students :-

Thanks,

JMaan

Reply to this.
Anonymous at 02 Sep, 2008 07:16
I have installed active perl (DzSoft Perl Editor)on windows xp
plz tell me how to execute any perl program on command prompt.
& also tell me how to test perl is sucessfully installed or not?

Thanks,
Lalita
Reply to this.
Comment

Please dont enter you comments in this form - this is a fake form to confuse spamming bots. The next form is the real one.




Comment




Comment Formating : HTML tags a, strong, em, b, i, code, pre, p and br allowed. Other tags will be shown as code(< will become &lt;). Urls, Line breaks will be auto-formated.
Subscribe to Feed