LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-02-2016, 01:45 PM   #1
arry617
LQ Newbie
 
Registered: Mar 2016
Posts: 7

Rep: Reputation: Disabled
Range for filesize in ls -l


I am trying to display the files whos sizes are in a specific range. This script will take two arguments as the lower bound and upper bound of the file size, and prints out a list of filenames and their sizes. I tried this:

for i in {$0..$1}
do
set -- $(ls -l "$i")
echo $i: $5 bytes
done

I'm pretty sure I'm implementing the range incorrectly, but I don't know how to make it work. Any suggestions?
 
Old 05-02-2016, 02:03 PM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,159
Blog Entries: 10

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
Quote:
Originally Posted by arry617 View Post
Any suggestions?
Which shell?
 
Old 05-02-2016, 02:06 PM   #3
arry617
LQ Newbie
 
Registered: Mar 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
bash shell
 
Old 05-02-2016, 02:40 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
As this is an extension of your other question (which you have not marked as SOLVED), you should ask it there as people are already trying to help you.
 
  


Reply

Tags
linux, newbie, scripts


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script to ping a range or own IP-range ugurgazi Programming 13 05-02-2016 10:08 AM
Gnuplot - Combining a linear range and log-scale range in the same X-axis llauro Linux - Software 2 04-26-2011 01:55 PM
[SOLVED] What are short range link and long range links in routing? mq15 Linux - Networking 6 06-27-2009 12:16 AM
getting filesize munna_dude Programming 2 04-10-2007 02:23 AM
increasing filesize tn1681 Linux - General 1 05-01-2003 09:11 AM


All times are GMT -5. The time now is 10:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration