Hello,
I have data in one file like -
UNB+UNOA:1+006415160:1+WF0000010188:ZZ+080701:0600+2++DELFOR++++T'UNH+2+DELFOR:D:97A:UN................
Now, I want to find what is the character immediately following UNB(here +) UNOA (here :) or the character immedialtely preceding UNH (here ') &... (2 Replies)
Hello!!
I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory:
drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Hi All,
I have to maintain few servers and in those servers in a specific directory some special jobs keeps on running .......
The directory is having many kind of files like.....acd*, hud*, rca*....bla bla bla.......
My aim is that if due to any job-any time a file having initials like... (4 Replies)
I would need a command for finding first 15000 of the file names whose 25th postion is 5 in the current directory alone.
I do have this painful command
find . -name '5*' | head -15000 | cut -c3-
please refine this.
Of course the above command also searches in the sub directories... (3 Replies)
Dear Members,
I have a list of xml files like
abc.xml.table
prq.xml.table
...
..
.
in a txt file.
Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file.
Please help me with the script or command to do so.
... (11 Replies)
Hi,
I have more than 1000 directories under one directory (lets says under /home/).
Sub directories are like A1 to A100,B1 to B100 etc..
Here my problem is I need to find the files older than 10 days in the directories which starts with A*.
I tried some thing like this which is not... (2 Replies)
I need a Shell script which take two inputs which are
1) main directory where it has to search and
2) pattern to search within main directory all files (.c and .h files)
It has to print number of pattern found in main directory & each sub directory.
main dir --> Total pattern found = 5
|... (3 Replies)
Hi,
I have file in my $datadir as below :-
SAT_1.txt
SAT_2.txt
BAT_UD.lst
BAT_DD1.lst
DUTT_1.txt
DUTT_la.txt
Expected result :-
should get all the above file in $<Filename>_file.lst
Below is my code :-
for i in SAT BAT DUTT
do
touch a.lst
cd $datadir (1 Reply)
Discussion started by: satishmallidi
1 Replies
LEARN ABOUT OPENSOLARIS
dirname
dirname(3C) Standard C Library Functions dirname(3C)NAME
dirname - report the parent directory name of a file path name
SYNOPSIS
#include <libgen.h>
char *dirname(char *path);
DESCRIPTION
The dirname() function takes a pointer to a character string that contains a pathname, and returns a pointer to a string that is a pathname
of the parent directory of that file. Trailing '/' characters in the path are not counted as part of the path.
If path does not contain a '/', then dirname() returns a pointer to the string "." . If path is a null pointer or points to an empty
string, dirname() returns a pointer to the string "." .
RETURN VALUES
The dirname() function returns a pointer to a string that is the parent directory of path. If path is a null pointer or points to an empty
string, a pointer to a string "." is returned.
ERRORS
No errors are defined.
EXAMPLES
Example 1 Changing the Current Directory to the Parent Directory.
The following code fragment reads a pathname, changes the current working directory to the parent directory of the named file (see
chdir(2)), and opens the file.
char path[[MAXPATHLEN], *pathcopy;
int fd;
fgets(path, MAXPATHLEN, stdin);
pathcopy = strdup(path);
chdir(dirname(pathcopy));
fd = open(basename(path), O_RDONLY);
Example 2 Sample Input and Output Strings for dirname().
In the following table, the input string is the value pointed to by path, and the output string is the return value of the dirname() func-
tion.
+-----------------------------+-----------------------------+
| Input String | Output String |
+-----------------------------+-----------------------------+
|"/usr/lib"" |"/usr" |
+-----------------------------+-----------------------------+
|"/usr/" |"/" |
+-----------------------------+-----------------------------+
|"usr" |"/" |
+-----------------------------+-----------------------------+
|"/" |"/" |
+-----------------------------+-----------------------------+
|"." |"." |
+-----------------------------+-----------------------------+
|".." |"." |
+-----------------------------+-----------------------------+
USAGE
The dirname() function modifies the string pointed to by path.
The dirname() and basename(3C) functions together yield a complete pathname. The expression dirname(path) obtains the pathname of the
directory where basename(path) is found.
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), chdir(2), basename(3C), attributes(5), standards(5)SunOS 5.11 18 Mar 2002 dirname(3C)