AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
  • 1.  find command modify the output

    Posted Sat January 22, 2011 03:07 PM

    Originally posted by: raokl


    Hello All,

    I am new to this shell scripting , I wanted to modify the output of my find command such that it does not display the path but only file names , for example I am searching for the files which are modified in the last 24 hours which is

    find /usr/monitor/text/ -type f -mtime -1 -print , this is returning me the output as

    /usr/monitor/text/abc.txt
    /usr/monitor/text/def.txt
    /usr/monitor/text/ijk.txt

    but i want to modify the output such that it gives only the file names and remove the path

    please advice me on this
    #AIX-Forum


  • 2.  Re: find command modify the output

    Posted Sat January 22, 2011 04:48 PM

    Originally posted by: hdkutz


    Hello,
    go directly into the Directory and execute
    find . -mtime ......
    If there were Directorys in your path you'll have the same problem.

    You could use the basename command to cut off the path of your find results.

    Which Problem are you trying to solve?

    Cheers,
    ku
    #AIX-Forum


  • 3.  Re: find command modify the output

    Posted Mon January 24, 2011 10:12 AM

    Originally posted by: hgmiguel


    Hello,

    find /usr/monitor/text/ -type f -mtime -1 -exec basename {} \;
    #AIX-Forum