Comparison doubt..


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Comparison doubt..
# 1  
Old 05-05-2009
Comparison doubt..

Hi,

/etc/fstab file contains:
==================
cluster_root#root / advfs rw 0 1
cluster_usr#usr /usr advfs rw 0 2
cluster_var#var /var advfs rw 0 2
/proc /proc procfs rw 0 0
t_d#t_f /t_m advfs rw 0 2
/dev/disk/dsk1c /ufs_mnt ufs rw,userquota=/advfs_mnt/quota.user 1 2
test#test /advfs_mnt advfs rw,userquota=/ufs_mnt/quota.advfs 0 2

Need to check whether quota file(say quota.user and quota.group) is within the same fileset or not.


Second argument of /etc/fstab file is nothing but fileset location and 4th argument of /etc/fstab file is also fileset location.So need to compare 2nd and 4th argument of /etc/fstab file.If both locations are same then we can confirm that quota files are in same fileset).

Consider below situation say,
1./dev/disk/dsk1c /ufs_mnt ufs rw,userquota=/advfs_mnt/quota.user 1 2
2.test#test /advfs_mnt advfs rw,userquota=/ufs_mnt/quota.advfs 0 2
Second argument of Line1 is /ufs_mnt and 4th argument is rw,userquota=/advfs_mnt/quota.user.In this case both locations are different i.e (/ufs_mnt and /advfs_mnt).

Could you please let me know how to compare 2nd and 4th argument in /etc/fstab file.

Thanks,
Mansa
# 2  
Old 05-05-2009
Something like this?

Code:
awk '/quota/ && !(match($4,$2))'  /etc/fstab

# 3  
Old 05-06-2009
Thanks Franklin for your reply and solution..

This solution requires slight modification..

$ awk '/quota/ && !(match($4,$2))' /etc/fstab
domain#ufs_mnt /ufs_mnt advfs,rw,userquota=/ufs_mnt,groupquota=/ufs_mnt 0 2


Here,eventhough second argument is /ufs_mnt is same as 4th argument userquota=/ufs_mnt and groupquota=/ufs_mnt" .But the output which we are getting now is wrong.

Could you please correct it and let me know..Even i tried it,but am not able to find correct solution.

Thanks alot in Advance,
Manasa.
# 4  
Old 05-06-2009
The reason is that the number of fields are different, this should match the 3th and the 4th field:

Code:
awk '/quota/ && (!(match($4,$2)) && !(match($3,$2)))' /etc/fstab

Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Doubt

in my shell script requirement is to search and replace the file with variable so i use the following command sed -i "s/abc/$SCHEMA/g" table.sql later when the script runs sqlplus username/pwd@Table& this & is not letting the variable to replace the value inside the file .please let me know... (1 Reply)
Discussion started by: bhuvan1
1 Replies

2. Red Hat

Doubt

How to create a file with specific size in RHEL6 (1 Reply)
Discussion started by: Sashi Kanth A
1 Replies

3. Red Hat

doubt

I need help in opening the .exe files in linux. As i have downloaded ubuntu os from trail version. after executing the the file name in terminal it is stating that get archive files for opening the .exe files. But i am unable to get it please help me (2 Replies)
Discussion started by: yashwanthguru
2 Replies

4. Shell Programming and Scripting

Doubt in integer comparison

Hi What is the difference between following commands Command1 length=1 if ] ; then echo "Hellow world" fi Command 2 length=1 if ] ; then echo "Hellow world" fi which is correct usage from this (2 Replies)
Discussion started by: morbid_angel
2 Replies

5. Shell Programming and Scripting

Doubt

Hi, I have a file with multiple entries and I have calculated the percentages. Now I want to know how many of my entries are there between 1-10% 11-20% and so on.. chr1_14401_14450 0.211954217888936 chr1_14451_14500 1.90758796100042 chr1_14501_14550 4.02713013988978... (1 Reply)
Discussion started by: Diya123
1 Replies

6. Shell Programming and Scripting

Doubt??

I jus want to know the meaning of the below command line(exclamation following that re-direction) sqlplus -s `cat /home/sample.txt` <<! Thanks!! (1 Reply)
Discussion started by: nohup
1 Replies

7. UNIX for Dummies Questions & Answers

doubt on name

HI, Iam jus tin a confusion that solaris and unix are the same.if they are diffrent,how they are?pls give me a brief idea abt these two. I will be very grateful to you thanks (1 Reply)
Discussion started by: shruti_mgp
1 Replies
Login or Register to Ask a Question