|
From: | Christof Warlich |
Subject: | Re: [Help-bash] latest |
Date: | Sun, 27 Nov 2016 10:40:40 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
Am 27.11.2016 um 05:43 schrieb Val Krem:
Hi all, I am trying to fine the latest 5 files in a given folder and count the number of rows in each of files I used, ls -1t | head -5. How do I pass these files to the command wc -l? Thank you in advance
Assuming you want to print the number of lines of each file: for i in $(ls -1t | head -5); do wc -l $i; doneFurther note that using ls -1t also lists directories, which you may want to exclude.
[Prev in Thread] | Current Thread | [Next in Thread] |