ls arg list too long

Posted on 2004-11-15
Last Modified: 2008-02-01
Greetings experts,

This is not a homework assignment.  I have the following assignment in my script:
my @reportfiles = `/usr/bin/ls *.day | grep -v`;    

This yields sh: /usr/bin/ls: arg list too long

How do I correct this?

TIA for your help.
Question by:uluttrell
    LVL 13

    Accepted Solution

    You have more '*.day' files in your directory than ls can cope with. You could try using perl's internal globbing to do this:

    my @reportfiles = grep { !/00\.day$/ } <*.day>;

    Author Comment

    Thank you gripe.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    Title # Comments Views Activity
    rename outfile before writing 2 64
    syslog unix file 20 60
    PERL - Find newest folder 12 85
    Formatting stings with pack and printf in perl 5 35
    I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
    There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now