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)
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)
Hello,
I'm trying to write a bash script that will query the current system time (OS X 10.6.6) and then convert the output from HH:MM:SS into time in seconds. The output of the system time command (systemsetup -gettime) is returned as:
Time: HH:MM:SS
so I wanted to use awk -F: to grab... (5 Replies)
Hi,
Can anyone please help me with this issue.
I have a Awk command which take file as input, and provides the output having multiple lines, its working in command mode, but not if i plug it in script.
#!/bin/ksh
infile=a.txt
outfile=b.txt
awk '
BEGIN{
FS=OFS="|";ORS = "\n";... (1 Reply)
Hello experts
I want to execute a awk command, which reads from txt files and sums the numbers from the first column for those listed only inside a <init> block -- The awk command is like
awk '/<\/?init>/{x = !x}x{a++}x && a > 2{sum+=$1}END{printf"%E" "\n", sum}
So, I want to execute... (2 Replies)
im trying to extract the basename of a process running on a host
processx is running at host1 as /applications/myapps/bin/processx
i wanted to check if its running, then extract the basename only using:
$ ssh host1 "ps aux | grep -v 'grep' | grep 'processx'" | awk '{ print basename $11}'
... (10 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)
Hi
I have a requirement where i need to convert the xml in various lines into a single line and then split the file so that the file contains only 1000 records each.
searching this forum, i found a command which converts the xml in various line
into a single line, but i have trouble using that... (3 Replies)
Hello,
I have text data that looks like this,
Mrv16a3102061815532D
6 6 0 0 0 0 999 V2000
-0.4018 1.9634 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.1163 1.5509 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.1163 0.7259 ... (9 Replies)
Discussion started by: LMHmedchem
9 Replies
LEARN ABOUT SUNOS
basename
basename(1) User Commands basename(1)NAME
basename, dirname - deliver portions of path names
SYNOPSIS
/usr/bin/basename string [suffix]
/usr/xpg4/bin/basename string [suffix]
dirname string
DESCRIPTION
The basename utility deletes any prefix ending in / and the suffix (if present in string) from string, and prints the result on the stan-
dard output. It is normally used inside substitution marks (``) within shell procedures.
/usr/bin
The suffix is a pattern defined on the expr(1) manual page.
/usr/xpg4/bin
The suffix is a string with no special significance attached to any of the characters it contains.
The dirname utility delivers all but the last level of the path name in string.
EXAMPLES
Example 1: Setting environment variables
The following example, invoked with the argument /home/sms/personal/mail sets the environment variable NAME to the file named mail and the
environment variable MYMAILPATH to the string /home/sms/personal:
example% NAME=`basename $HOME/personal/mail`
example% MYMAILPATH=`dirname $HOME/personal/mail`
Example 2: Compiling a file and moving the output
This shell procedure, invoked with the argument /usr/src/bin/cat.c, compiles the named file and moves the output to cat in the current
directory:
example% cc $1
example% mv a.out `basename $1 .c`
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of basename and dirname: LANG, LC_ALL,
LC_CTYPE, LC_MESSAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
/usr/bin
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
/usr/xpg4/bin
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWxcu4 |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO expr(1), basename(3C), attributes(5), environ(5), standards(5)SunOS 5.10 18 Mar 1997 basename(1)