Sponsored Content
Top Forums Shell Programming and Scripting [ask]elimination with diskspace Post 302552602 by itkamaraj on Monday 5th of September 2011 01:00:46 AM
Old 09-05-2011
Just execute the below command and check the output. If you are satisfied with output, then remove the highlighted (red color) echo from the nawk

Code:
 
deleted

Try this...

Code:
 
df-h | nawk ' $NF~/\/$/ { size=int(substr($2,length($2)-2,length($2)-1)); if( size > 20) {print "echo echo rm /tmp/*.txt"} else {print "echo echo Disk usage is under 20"}}' | sh


Last edited by itkamaraj; 09-05-2011 at 02:21 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Diskspace

Hi there, pls help me, i have a problem, how i can find out the disk amount of each harddisk per command (not the on label on the Harddisk) i need it on HP UX and Sun. can anybody helb me???? pls thanks Scotty (1 Reply)
Discussion started by: scotty
1 Replies

2. Shell Programming and Scripting

to compute diskspace

Guys, have any idea for the script like this? also to compute w/ decimal. thanks a=10 b=20 c=30 d=40 if a < b then ( a -b)*1024 = free space b + (c -d) = total space if a > b then (b / d)*1024 = cpu (3 Replies)
Discussion started by: kenshinhimura
3 Replies

3. Shell Programming and Scripting

ASM Diskspace

Hi I want to check Oracle ASM disk status through a PERL script. Script flow would be like this ... 1. Its taking diskgroup name in the command line... 2. Connect to Oracle database 3. If connection error send a critical message. Plz replyyyyyyy...... (1 Reply)
Discussion started by: Harikrishna
1 Replies

4. Shell Programming and Scripting

4 x fibre cards elimination

Hi, I have variables like mentioned below and want to separate as mentioned in output. var1="4 x fibre cards" var2="2 fibre cards" var3="6 - fibre cards" var4="4 x dual-port" I have variables like this.I want to separate numbers from this and fibre cards from this. output has to be... (4 Replies)
Discussion started by: ajilesh
4 Replies

5. Shell Programming and Scripting

Date elimination

I have a file with the following data. I want to start writing lines out of this file to another file only after the time is greater than 20:00:00 hours and the first job is U1KC000. I would like to be able to run this out of a script and pass the time and job(U1KC000) as an argument. ... (14 Replies)
Discussion started by: wawa
14 Replies

6. Solaris

graphical diskspace analyzer

Hi all, recently I took over the admin task for a solaris 5.10 machine. Being a little bit familiar with debian systems Solaris is up to now a complete mystery to me. The first thing I would like to have is a graphical diskspace analyzer. I mean something like BaoBab under gnome. I there a... (2 Replies)
Discussion started by: sly_dunbar
2 Replies

7. Shell Programming and Scripting

duplicate elimination with column print

hi, my input a b c d e f g k i m g i k l b i n g o h m a b c d e b i n g o my output a b c d e f g k i m g i k l b i n g o h m what I would like to do is compare the first five columns of each row to the entire records in the file and if there is a match, eliminate that... (1 Reply)
Discussion started by: jacobs.smith
1 Replies

8. Shell Programming and Scripting

DiskSpace Error

Hi, While am preparing the script for diskspace for different partitions different threshhold limit. am getting below error: ./test.sh: syntax error at line 5: `space=$' unexpected Script ==== #!/bin/sh df -h |grep -v '/oradata2'|grep -v '/orabkp' |grep -v '/oradata5' | awk '{ print $5... (7 Replies)
Discussion started by: Pavan83
7 Replies

9. Red Hat

Check free diskspace

Hi all, I would like to know what was the free disk space available in my system for last two days back. I know how to check free disk space by command below. df -h But i want to know the same outcome for last two days back. Please help me. Reg, Mastan (5 Replies)
Discussion started by: mastansaheb
5 Replies

10. UNIX for Dummies Questions & Answers

Allocate diskspace AT&T SV R4

# Hello -all, I have a problem with the SV R4 install. During the floppy2 procedure I get the message that I allocated less than 35 Mb for UNIX. It's a clean install, no other OS. Just a clean PC with a 40Gb disk. I get the # prompt telling me to restart the installation to allocate more Mb's..... (2 Replies)
Discussion started by: raylier
2 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.11 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 12:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy