Search the web
Sign In
New User? Sign Up
geeksthatgawk · for GNU Awk questions & discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Re: [Geeks that Gawk] Re: Help On awk   Message List  
Reply | Forward Message #192 of 221 |
Or might try this one:



awk -F":" '{if($1 == ZZ){print $6}}' ZZ=${username}
passwd.bak >output





_____

From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com] On Behalf Of Adam
Sent: Monday, December 26, 2005 7:09 PM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] Re: Help On awk



I'm not sure, but
it looks like the apostrophies get in the way.
try:
awk -f":" '/'$username'/ { print $6 }' passwd.bak >output

I hope that works.

--- In geeksthatgawk@yahoogroups.com, renuka prasad
<renukaprasadtg@y...> wrote:
>
> Hi All,
>
> I need a help from u.I'm getting the home directory
> from passwd.bak file.I need to find the disk usage of
> that particular user.I'm getting output if i directly
> substitue variable $username with exact username.But
> i'm not getting output when i use in shell script.The
> contents is as follows:
>
> ---------------------------------------------------------------------
> # Script for displaying diskusage based on user name
> # Only username to be supplied by user
> echo "\n Please enter the username:\c"
> read username
> awk -F":" '/$username/ { print $6 }' passwd.bak >
> output
> echo " Home Directory Of $username "
> cat output
> echo " Disk Usage in KB:"
> sudo du -sk < output
> ----------------------------------------------------------------------
> I really appreciate any kind of help on this.Thanks
> in advance.
>
> Regards,
> Prasad
>
>
>
>
> __________________________________
> Yahoo! for Good - Make a difference this year.
> http://brand.yahoo.com/cybergivingweek2005/
>







SPONSORED LINKS

Basic programming language
<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic
+programming+language&w2=Computer+programming+languages&w3=Programming+l
anguages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbV
U-A>

Computer programming languages
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=B
asic+programming+language&w2=Computer+programming+languages&w3=Programmi
ng+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KV
ZQperFQ>

Programming languages
<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+langua
ges&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>


Java programming language
<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+
programming+language&w2=Computer+programming+languages&w3=Programming+la
nguages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB
1g>







_____

YAHOO! GROUPS LINKS



* Visit your group "geeksthatgawk
<http://groups.yahoo.com/group/geeksthatgawk> " on the web.

* To unsubscribe from this group, send an email to:
geeksthatgawk-unsubscribe@yahoogroups.com
<mailto:geeksthatgawk-unsubscribe@yahoogroups.com?subject=Unsubscribe>

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .



_____



[Non-text portions of this message have been removed]




Tue Dec 27, 2005 1:55 pm

dasthcc
Offline Offline
Send Email Send Email

Forward
Message #192 of 221 |
Expand Messages Author Sort by Date

Or might try this one: awk -F":" '{if($1 == ZZ){print $6}}' ZZ=${username} passwd.bak >output _____ From: geeksthatgawk@yahoogroups.com ...
Stout, Danny
dasthcc
Offline Send Email
Dec 27, 2005
1:56 pm

Sorry about the previous wrong example. For GAWK the format is a little bit different than the AWK format. Here is the GAWK format: gawk -F":" '{if($1 == ZZ)...
Stout, Danny
dasthcc
Offline Send Email
Dec 27, 2005
6:52 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help