- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Find Command
Operating System - HP-UX
1820199
Members
3882
Online
109620
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2008 10:07 PM
тАО07-29-2008 10:07 PM
Find Command
I am using the below find command in my code and i am redirecting the output to a file findout in the /tmp folder. I am concerned about the disk space of the tmp folder. It's now having 459 MB free space. I want to check if the output of find command is below 50 MB redirect the output to the findout file in /tmp folder otherwise throw a message "find out exceeded 50 MB limit" How can i do it?
find . -name "R*.ulog.gz" | xargs zgrep -i "SEARCHCONTENT" | cut -f 1 -d ' ' >/tmp/findout
find . -name "R*.ulog.gz" | xargs zgrep -i "SEARCHCONTENT" | cut -f 1 -d ' ' >/tmp/findout
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2008 12:08 AM
тАО07-30-2008 12:08 AM
Re: Find Command
>otherwise throw a message "find out exceeded 50 MB limit" How can i do it?
There are no good ways to do this without doing the find twice. Or read it all in memory and stop if too large.
Or put the file elsewhere and then move it to /tmp if < 50 Mb.
There are no good ways to do this without doing the find twice. Or read it all in memory and stop if too large.
Or put the file elsewhere and then move it to /tmp if < 50 Mb.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2008 02:04 AM
тАО07-30-2008 02:04 AM
Re: Find Command
You can do it by script
this script might work
nohup find . -name "R*.ulog.gz" | xargs zgrep -i "SEARCHCONTENT" | cut -f 1 -d ' ' >/tmp/findout &
while TRUE=ITRC;
do
SPACE=`du -sk /tmp/findout | awk '{print $1}'`
if [ "51200" -le "$SPACE" ]
then
echo "PROCESS ID $!"
echo "OVER SIZE STOPPING FIND PROCESS"
exit 0
else
echo "SIZE UNDER 50 MB"
fi
sleep 1
done
this script might work
nohup find . -name "R*.ulog.gz" | xargs zgrep -i "SEARCHCONTENT" | cut -f 1 -d ' ' >/tmp/findout &
while TRUE=ITRC;
do
SPACE=`du -sk /tmp/findout | awk '{print $1}'`
if [ "51200" -le "$SPACE" ]
then
echo "PROCESS ID $!"
echo "OVER SIZE STOPPING FIND PROCESS"
exit 0
else
echo "SIZE UNDER 50 MB"
fi
sleep 1
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2008 04:52 AM
тАО07-30-2008 04:52 AM
Re: Find Command
Single find command will not suffice this requirement.
Dennis is right you have to use find twice.
Dennis is right you have to use find twice.
"There is always some scope for improvement"
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP