Can't get DF output I desire


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can't get DF output I desire
# 1  
Old 03-05-2009
Question Can't get DF output I desire

I currently have a shell script that creates Oracle databases configured the way we want them here. One part of it allows you to choose which file system to place the database files. This is the command which works.
Quote:
select FS in `df 2>/dev/null |awk 'BEGIN {RS=" " } {print $0}' |egrep "/oradata|/oraindex" |grep
-v "^/dev/"|sort `
This produces a list of file systems from which to choose. I have been tasked to change this output to show not only the file system name but the corresponding free space. I have tried several hours worth of variations but have failed miserably. How can I achive this desired output?
# 2  
Old 03-05-2009

Does this do what you want:

Code:
pat1=/oradata
pat2=/oraindex
n=0

mkfifo dfout
df > dfout &

while read fs blocks used available pc mount
do
   case $mount in
     *$pat1* | *$pat2* )
         n=$(( $n + 1 ))
         printf "%2d. %s, %s\n" $n "$mount" "$pc"
         eval "fs_$n=\$mount"
         ;;
   esac
done < dfout

printf "Select filesystem (1..%d): " $n
read fs

eval "location=\$fs_$fs"

echo $location

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. What is on Your Mind?

Where do I start as someone who desire to become skilled in UNIX and C?

Hi, for some time now I have been away. Things got so though I had to get a job. Whilst on the job i never felt free to do the thing i truly desired. Its like two masters trying to get my attention. One had to go for the other. To sum up i quit my job and i felt that was the best decision i ever... (4 Replies)
Discussion started by: split_func0
4 Replies

2. UNIX for Dummies Questions & Answers

How to get desire line?

Hi Guys, I am newbie here and greeting to all guys of unix forum, now I want to learn unix here. I have query here, we have file where file has 20 line record, now i want display 10 to 15 line row record only, then how it possible. (5 Replies)
Discussion started by: aaditya321
5 Replies

3. Hardware

HTC Desire S vs HTC Desire C - USB Android tethering problem

Hi gurus, I have problem with android usb tethering (usb0 interface). I tried two phones HTC Desire C and HTC Desire S. With Desire C everything works as expected, usb0 automatically goes up and gains IP address and tethering is working (output bellow) HTC Desire C: Nov 6 23:32:36 HP-PC... (0 Replies)
Discussion started by: wakatana
0 Replies

4. Shell Programming and Scripting

Users who desire to have their .profile executed must explicitly do so in the crontab entry. Why?

The .profile file should be read when the user logs in. So, there should be no need to execute .profile file again in a cron job (since the cron job is run after the user logs in). Doesn't the cron require login from the user. Then, from where does the cron execute? Please help!! (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

5. Shell Programming and Scripting

Desire structure for input file

Hello Unix gurus, I have a txt file with single columns with n no of rows.like below COLUMN1 ======= AAA BBB CCC DDD EEE FFF GGG HHH . . . NNN. (10 Replies)
Discussion started by: kanakaraju
10 Replies

6. Shell Programming and Scripting

How to insert and delete any line after desire line

like i have file like abc 123 pqr bbbb ttttttttt t tttt ------------------ i want to insert "class" after pqr and t lines please suggest me. (4 Replies)
Discussion started by: RahulJoshi
4 Replies
Login or Register to Ask a Question