Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Calling Perl inside a csh script

Posted on 2003-03-11
2
Medium Priority
?
891 Views
Last Modified: 2013-12-26
#!/bin/csh -xv
blah
blah

#!/usr/contrib/bin/perl
perl -ane 'print if $F[2] ne $p; $p=$F[2]' finished1.txt > finish.txt             # Perl to remove duplicate contiguous lines

#!/bin/csh -xv
blah
blah

Hi all,
     
     I want to run one line of perl shown above in a UNIX script. Unfortunately it is not working when it is called by the crontab. On my own machine the script runs just fine. Someone has suggested that the crontab does not know the location of the perl interpreter. (Note:the code above will be all part of the one program so I'm not sure that I should be using   #!/bin/csh -xv   twice)
The log file shows the following error from the cron job: perl: Command not found.
Am I calling the perl interpreter properly?? AND when I am going back to using unix commands should I re-use !/bin/csh again??

Thanks
0
Comment
Question by:Deeteees
2 Comments
 
LVL 9

Accepted Solution

by:
HamdyHassan earned 400 total points
ID: 8113289
replace these two lines
#!/usr/contrib/bin/perl
perl -ane 'print if $F[2] ne $p; $p=$F[2]' finished1.txt > finish.txt             # Perl to remove duplicate contiguous lines


/usr/contrib/bin/perl -ane 'print if $F[2] ne $p; $p=$F[2]' finished1.txt > finish.txt             # Perl to remove duplicate contiguous lines



0
 
LVL 48

Expert Comment

by:Tintin
ID: 8114787
No need for Perl.  Use 'uniq', eg:

uniq finished1.txt >finish.txt
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question