?
Solved

Calling Perl inside a csh script

Posted on 2003-03-11
2
Medium Priority
?
878 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

771 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