LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-15-2005, 01:18 PM   #1
branall1
LQ Newbie
 
Registered: Nov 2005
Posts: 14

Rep: Reputation: 0
Trying to show only certain lines over a certain size in a file


Hello everyone,

I have written a script that outputs the size of directories to a file. I now need to take the data and show only certain directories over a certain size. he layout of the file is this:

50 ./directory/
55 ./directory2/
60 ./directory3/

etc.

I was wondering if there is a way to do this using cat or anything like that.

Thanks everyone!

Brandon Allhands

PS: The file is HUGE. The directory structure I searched is over 300,000 directories. This will eventually be imported into a database, but I would like to filter the raw data as much as possible first.
 
Old 11-15-2005, 04:16 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
all depends what these sizes are... what IS "60" ??? assuming these are all reliably the same units and you're not suddenl;y going to have to deal with "10M" or something, i'd just say use awk, tis a doddle
Code:
awk '{ if ($1 > 100) print }' list
i.e. print all lines who's first field is larger than 100 from the file "list"
 
Old 11-15-2005, 04:49 PM   #3
branall1
LQ Newbie
 
Registered: Nov 2005
Posts: 14

Original Poster
Rep: Reputation: 0
Works great. Thank you! I have never played around with awk before, but this has most definitely piqued my interest.

Thank you again,

Brandon
 
  


Reply


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
Why does linux show less size of CD? aristarchus Debian 3 10-20-2005 03:34 AM
file system size larger than fysical size:superblock or partition table corrupt klizon Linux - General 0 06-18-2004 05:18 PM
Removing lines from file Aylar Programming 2 04-22-2004 07:34 AM
Screen size too big, I lose the last lines! 000 Linux - Newbie 4 11-13-2003 08:45 AM
show size of all filesin a directory watashiwaotaku7 Linux - Newbie 4 09-30-2003 12:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:52 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