Re: how to use find - Linux

This is a discussion on Re: how to use find - Linux ; "milton" wrote in message news: ... > **** Post for FREE via your newsreader at post.usenet.com **** > > Hi,I want to find the username whose file is large than certain quantity,and > the output print with ./ prefix,I think ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: how to use find

  1. Re: how to use find

    "milton" wrote in message news:<3fb3456a@post.usenet.com>...
    > **** Post for FREE via your newsreader at post.usenet.com ****
    >
    > Hi,I want to find the username whose file is large than certain quantity,and
    > the output print with ./ prefix,I think that maybe mean current
    > directory.Now I want to only show the username without prefix ./
    >
    > I tried "find . -size +1000k -fprintf xx %f",but the output carried without
    > newline.
    > The manual says fprintf write file same as printf with new line.
    >
    > For I write a shell script to mail the user which locates in the file
    > "xx",such as
    > "find . -size +1000k -printf >xx
    > usrname='cat xx'
    > for usr in $usrname;do
    > mail $usr > done "
    > and now the file xx is with ./ prefix,so cannot mail to correct user.
    > Any reply would be appreciated.
    >
    >
    >
    > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    > *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
    > http://www.usenet.com
    > Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
    > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



    Are you getting a . or a ./ prefix ? Well anyway all you have to do is add the
    following in your script.

    find . -size +1000k -printf %f | cut -d. -f2 >xx

    That will give you just the username.

    Good Luck have fun !

  2. Re: how to use find

    fersher@hotmail.com (Chris) wrote in message news:<1717582c.0311161706.2b021d76@posting.google.com>...
    > "milton" wrote in message news:<3fb3456a@post.usenet.com>...
    > > **** Post for FREE via your newsreader at post.usenet.com ****
    > >
    > > Hi,I want to find the username whose file is large than certain quantity,and
    > > the output print with ./ prefix,I think that maybe mean current
    > > directory.Now I want to only show the username without prefix ./
    > >
    > > I tried "find . -size +1000k -fprintf xx %f",but the output carried without
    > > newline.
    > > The manual says fprintf write file same as printf with new line.
    > >
    > > For I write a shell script to mail the user which locates in the file
    > > "xx",such as
    > > "find . -size +1000k -printf >xx
    > > usrname='cat xx'
    > > for usr in $usrname;do
    > > mail $usr > > done "
    > > and now the file xx is with ./ prefix,so cannot mail to correct user.
    > > Any reply would be appreciated.
    > >
    > >
    > >
    > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    > > *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
    > > http://www.usenet.com
    > > Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
    > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    >
    >
    > Are you getting a . or a ./ prefix ? Well anyway all you have to do is add the
    > following in your script.
    >
    > find . -size +1000k -printf %f | cut -d. -f2 >xx
    >
    > That will give you just the username.
    >
    > Good Luck have fun !


    I appologize. The previous will only work with a single user. If you
    want to mail multiple use this.

    find $pwd -size +1000k -fprintf xx %f"\n"
    usrname=`cat xx | sed 's/^.$//'`
    for usr in $usrname ; do
    mail $usr done

    The sed portion will remove the first line of the file which without
    it will be a . once again specifying the pwd. There are various ways
    to do this. This is just a easy one liner version. Get a book on
    scripting to broaden your horizon.

    Have fun.

+ Reply to Thread