LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-17-2004, 06:12 AM   #1
nukeu666
Member
 
Registered: Mar 2004
Location: India
Distribution: MDK, Fedora, Debian Unstable (current)
Posts: 80

Rep: Reputation: 15
explain this little script plz


i need help with another little script from TLDP

edquota -p bob `awk -F: '$3 > 499 {print $1}' /etc/passwd`

this automatically adds users to the edquota list by copying what bob has his as...
what does awk do (yes, i have rtfm and didnt get it)
what does the -p do...i didnt ge what prototype usernmae means...
i want the uids from 20000 to 22000 to be selected only, not 500+ so what do i edit in here?
 
Old 08-17-2004, 07:43 AM   #2
rkdugar
LQ Newbie
 
Registered: Jul 2004
Posts: 13

Rep: Reputation: 0
The awk statement "awk -F: '$3 > 499 {print $1}' /etc/passwd" extracts all the users with UID greater than 499. The edquota command will edit the quotas of the users extracted by the awk statement.

To select UIDs between 20000 - 22000, you can use the following awk statement:

awk -F: '$3 > 20000 && $3 < 22000 {print $1}' /etc/passwd

In the awk statement $3 specifies the third field in the /etc/passwd file, which is the UID field and $1 specifies the first filed, usernames.

Cheers,

rkdugar
 
Old 08-17-2004, 07:48 AM   #3
paulinimus
Member
 
Registered: Aug 2004
Distribution: SLACKWARE10.0
Posts: 65

Rep: Reputation: 15
Actually, if the logic of the parent post is correct, the below is true:

awk -F: '$3 > 19999 && $3 < 22001 {print $1}' /etc/passwd
 
Old 08-18-2004, 01:09 AM   #4
nukeu666
Member
 
Registered: Mar 2004
Location: India
Distribution: MDK, Fedora, Debian Unstable (current)
Posts: 80

Original Poster
Rep: Reputation: 15
thnx for the awk info

i stil dont get what the -p does in edquota....what are prototype-usernames?
 
Old 08-18-2004, 01:52 AM   #5
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
The -p specifies what user to look at as a template. Specifically, every user that awk returns will have their quotas changed to match the quota settings for user bob.
 
  


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
explain me this c code plz alaios Programming 1 06-03-2005 06:32 AM
plz plz help me regarding route mapping nedian123 Programming 1 07-13-2004 09:17 AM
plz plz solve my route mapping problem nedian123 Linux - Networking 1 07-12-2004 10:41 PM
can someone explain this error plz? santasballz Linux - Newbie 5 02-10-2004 02:18 PM
redhat problems plz plz help sap666 Linux - Newbie 5 07-30-2003 11:57 AM


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