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...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

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
Help On awk   Message List  
Reply | Forward Message #191 of 221 |
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/
>







Tue Dec 27, 2005 1:09 am

adam_onza
Offline Offline
Send Email Send Email

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

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...
renuka prasad
renukaprasadtg
Offline Send Email
Dec 26, 2005
3:40 pm

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....
Adam
adam_onza
Offline Send Email
Dec 27, 2005
1:09 am
Advanced

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