Is it possible someone's put a program or script named either "cat" or "sort" somewhere on your path before /usr/bin?
Another possibility: did you chdir somewhere else in your script? $file may not be in the current directory, in that case.
You're also needlessly using cat. It probably doesn't matter, but why not just do this:
system("sort -t\\| +1 -2 -o $file.out $file");
Also, make sure sort is on the path when the script runs; if it runs from a crontab or webserver, it might not be.
It's probably safer to do:
system("/usr/bin/sort -t\\| +1 -2 -o $file.out $file");
You might have to change the /usr/bin if that's not where your sort binary is.
--
Mike
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.