Help! Need to convert bash shell to perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help! Need to convert bash shell to perl
# 1  
Old 06-19-2008
Help! Need to convert bash shell to perl

Hello All. I am very new to Linux and I am currently interning. I have been working on a project for 2 weeks now and I have had no success. I have to convert bash shell into perl to decrypt and store files. Here is the code in Linux and Bash. Any help would be greatly appreciated.

$ cd/usr/data/images/idtdata
$ mv pgs/155*.pgp .
$ ./dcryptidt (dcryptidt written in bash is:
for i in `ls -l *.pgp`
do
`/usr/bin/gpg --passphrase-fd 0 $i < .sunspot`
done)
$ mv *.pgp pgps/080531
$ cd txts
$ mv ../*.txt .
$ rm loadfile.seq
$ ./updidtf (updidtf written in bash is:
for i in `ls -l *.txt`
do
`./cnvidtf.pl $i`
`curl -u mydrive:password --disable-epsv -T loadfile.seq
ftp://11.1.11.1`
`mysql -u mydrive -h 11.1.11.1 -ptpassword < ldinsdocs.sql`
done)
$ mv * .txt hold/080501
$ cd..

(./cnvidtf.pl is already written in perl and the code is:
if ( $#ARGV < 0) {
die ("Need a file name, usage is cnvidtf FILENAME. \n");
}
$atab = "\t";
$infile = $ARG[0];
$output file = ">loadfile.seq";
open(Ifile, $infile) || die ("Could not open input file. \n \n");

foreach $line (<Ifile>){
$ofiledatline = $atab.$line;
print Ofile $ofiledataline;
}

close (Ifile);
close (Ofile);
Reply With Quote
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl to shell convert

HI All, I am new in shell scripting ,can any one please help me to convert this scripts from Perl to Shell. Thank in advance. $customer=$ARGV; $rows=`hadoop fs -ls /ncip/$customer/|wc -l`; if($rows==3){ print "$customer directory exists , cleaning up ! \n"; `hadoop fs -rm... (1 Reply)
Discussion started by: Atul301
1 Replies

2. Shell Programming and Scripting

Convert bash to simple perl

please delete! (0 Replies)
Discussion started by: SkySmart
0 Replies

3. Shell Programming and Scripting

Convert perl to shell

Hi I am a novice in scripting .Please help me converting perl script into shell my ($ref) = shift; my $id; my $cnt=0; my $first =0; my $filename ; my $filename1 ; FOREACH:foreach my $r (qw(RET LSH PDM )) { $ref->{$cnt}->{num_errors} =0; $ref->{$cnt}->{num_warnings} =0;... (2 Replies)
Discussion started by: apassi
2 Replies

4. Shell Programming and Scripting

Convert a string to variable in Bash shell

Hi All; I have 2 variable let's say $A and $B. These are actually some remotely executed command outputs. I captured these values in my local variables. Here is my problem. When I try to do some arithmetic operation with these variables, I receive an error message. Neither expr nor typeset -i... (3 Replies)
Discussion started by: Meacham12
3 Replies

5. Shell Programming and Scripting

perl to shell convert

#!/usr/bin/perl #************************************************************** # # PERL SCRIPT # This script restarts the Application # # ##************************************************************** $ENV{'IFS'} = ' '; #open(STDERR,">&STDOUT"); #select... (2 Replies)
Discussion started by: srikoundinya
2 Replies

6. Shell Programming and Scripting

Convert perl program to shell

Hi is there a way that i can convert this simple perl program into shell script #!usr/bin/perl -w use strict; use warnings; open INPUTFILE, "uniqprobecoordinates.out" || die "canot open the file $!"; open OUTPUTFILE, ">", "1_4reads.out"; while(<INPUTFILE>) { chomp; ... (3 Replies)
Discussion started by: bhargavpbk88
3 Replies

7. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

Hi all, Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM. Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. Shell Programming and Scripting

BASH regex (convert from working perl version)

Hi there, I need to test that a variable ($VAR) matches a regex mask in BASH. I have the exact thing working in perl (below), but could somebody advise me how i would do the same in BASH ? do i need to use something like egrep ? #!/bin/perl -w my $VAR = "some value"; if ( $VAR =~... (4 Replies)
Discussion started by: rethink
4 Replies

9. Shell Programming and Scripting

***convert from perl to bash***

can any body translate the follwing script into one that works in bash? #!/usr/bin/perl # classify_books.pl my $csv_file = shift; my %categories = ( 'childrens' => 'childrens_books.txt', 'horror' => 'horror_books.txt', 'sports ' =>... (3 Replies)
Discussion started by: ferrycorsten73
3 Replies

10. UNIX for Dummies Questions & Answers

Intern needing to convert bash to perl.

Hello All. I am very new to Linux and I am currently interning. I have been working on a project for a week and I have had no success. I have to convert bash shell into perl to decrypt and store files. Here is the code in Linux and Bash. Any help would be greatly appreciated. $... (0 Replies)
Discussion started by: freak
0 Replies
Login or Register to Ask a Question
LIBBASH(7)							  libbash Manual							LIBBASH(7)

NAME
libbash -- A bash shared libraries package. DESCRIPTION
libbash is a package that enables bash dynamic-like shared libraries. Actually its a tool for managing bash scripts whose functions you may want to load and use in scripts of your own. It contains a 'dynamic loader' for the shared libraries ( ldbash(1)), a configuration tool (ldbashconfig(8)), and some libraries. Using ldbash(1) you are able to load loadable bash libraries, such as getopts(1) and hashstash(1). A bash shared library that can be loaded using ldbash(1) must answer 4 requirments: 1. It must be installed in $LIBBASH_PREFIX/lib/bash (default is /usr/lib/bash). 2. It must contain a line that begins with '#EXPORT='. That line will contain (after the '=') a list of functions that the library exports. I.e. all the function that will be usable after loading that library will be listed in that line. 3. It must contain a line that begins with '#REQUIRE='. That line will contain (after the '=') a list of bash libraries that are required for our library. I.e. every bash library that is in use in our bash library must be listed there. 4. The library must be listed (For more information, see ldbashconfig(8)). Basic guidelines for writing library of your own: 1. Be aware, that your library will be actually sourced. So, basically, it should contain (i.e define) only functions. 2. Try to declare all variables intended for internal use as local. 3. Global variables and functions that are intended for internal use (i.e are not defined in '#EXPORT=') should begin with: __<library_name>_ For example, internal function myfoosort of hashstash library should be named as __hashstash_myfoosort This helps to avoid conflicts in global name space when using libraries that come from different vendors. 4. See html manual for full version of this guide. AUTHORS
Hai Zaar <haizaar@haizaar.com> Gil Ran <ril@ran4.net> SEE ALSO
ldbash(1), ldbashconfig(8), getopts(1), hashstash(1) colors(1) messages(1) urlcoding(1) locks(1) Linux Epoch Linux