Hi,
I am using the following command to extract any log files that are older than 3 days using the following command.
find DIR/LOGDIR -type f -mtime +3 |grep LOG > log_list.out
The results are
DIR/LOGDIR/1.LOG
DIR/LOGDIR/2.LOG
DIR/LOGDIR/3.LOG
DIR/LOGDIR/4.LOG
How do inculde (basename... (4 Replies)
Hi guys if i do
a=`basename -e -s /home/j/john/*`
du -k -h $a | sort -nr | head -10
why when i run the script does it work but also say usage basename string
any ideas thanks (9 Replies)
hi if we have to use basename how can we do this in awk?
did the below but is not working..
psg -t "?"| awk '{
command=($5 ~ /^/)? $9:$8
# cmd_name=`basename $command` (gives error)
system("basename $command >>... (10 Replies)
I am having a hard time extracting the file name from the above code. Instead of printing /folder/file.1$.5$, I would like it to print the file name file.1$.5$.
I have tried using basename but it looks like NAWK or AWK does not recognise basename. Each time I type it in, it prints out the word... (4 Replies)
Hi,
can anyone let me know how to interpret the below third line in the following code.
Gone through the man pages of "basename", but no go.
for f in *.foo;
do
base=`basename $f .foo`
mv $f $base.bar
done
Thanks. (2 Replies)
Hi
I have been able generate a file ($ELOG) that can have multiple lines within it. The first column represents the full path source file and the other is the full path target ... the file names are the same but the target directory paths are slightly different.
<source_dir1>/file1 ... (4 Replies)
what is the meaning of "script_name=$(basename $0)", can someone please explain? (1 Reply)
Discussion started by: abhi200389
1 Replies
LEARN ABOUT SUNOS
basename
basename(3C) Standard C Library Functions basename(3C)NAME
basename - return the last element of a path name
SYNOPSIS
#include <libgen.h>
char *basename(char *path);
DESCRIPTION
The basename() function takes the pathname pointed to by path and returns a pointer to the final component of the pathname, deleting any
trailing '/' characters.
If the string consists entirely of the '/' character, basename() returns a pointer to the string "/" .
If path is a null pointer or points to an empty string, basename() returns a pointer to the string "." .
RETURN VALUES
The basename() function returns a pointer to the final component of path.
USAGE
The basename() function may modify the string pointed to by path, and may return a pointer to static storage that may then be overwritten
by a subsequent call to basename().
When compiling multithreaded applications, the _REENTRANT flag must be defined on the compile line. This flag should only be used in mul-
tithreaded applications.
EXAMPLES
Example 1: Examples for Input String and Output String
+-----------------------------+-----------------------------+
| Input String | Output String |
+-----------------------------+-----------------------------+
|"/usr/lib" |"lib" |
+-----------------------------+-----------------------------+
|"/usr/" |"usr" |
+-----------------------------+-----------------------------+
|"/" |"/" |
+-----------------------------+-----------------------------+
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO basename(1), dirname(3C), attributes(5), standards(5)SunOS 5.10 24 Jul 2002 basename(3C)