So I struggled to find a solution to the following problem:
I want to make sed print only part of multiple different paths.
So lets say we have
Can someone suggest a way to make sed or other utility print only the path name up to logs directory only? ie:
Thanks for the answers
By the way the solution will be implemented in a script which will run on multiple different machines, so the paths will always be different and not static.
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by RudiC; 01-20-2018 at 08:23 AM..
Reason: Added CODE tags.
Seems I'm inundating this forum with questions, but anyway:
I am writing a script that should accept one and only one argument when called.
That argument should designate a file, either with path/filename or just filename.
Now to the difficult bit:
I want to figure out a way to store... (9 Replies)
The line is simple, use " '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }'
I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ".
Thanks. (2 Replies)
Hi
I am trying to use sed to retrieve part of my html file's path. I am having a hard time getting what I want. Could someone give me some help?
I want to retrieve the section after html and before the file name
For example if I have the following, ... (3 Replies)
I'm trying to clean up my samba share and need to print the found file or print the path of the image it tried to searched for. So far I have this but can't seem to get the logic right. Can anyone help point me in the right direction?
for FILE in `cat list`; do
if ;
then
... (1 Reply)
Can any one tell me that how can i print all directory with their path in a given parent directory.
i.e. parent directory /home/usr/
Now this shoe directory may contain sevral directory
/home/usr
dir1/
dir1.1/
dir1.2/
dir2
dir2.1/
dir2.2/
... (5 Replies)
Hi,
I have a file abcd.txt which has contents in the form of full path file names i.e.
$home> vi abcd.txt
/a/b/c/r1.txt
/q/w/e/r2.txt
/z/x/c/r3.txt
Now I want to retrieve only the directory path name for each row
i.e
/a/b/c/
/q/w/e/
How to get the same through shell script?... (7 Replies)
hi,
i have a directory at /path/unix with the following files
1.txt
2.txt
3.txt
4.txt
I want to make another file called filenames.txt at a different location called /path/home. So, my output file would be
/path/home/filenames.txt with contents
/path/unix/1.txt... (1 Reply)
My input is as below :
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt
/splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt
/splunk/scrubbed/triumph/ifind.triumph.txt
From the above input I want to extract the file names only .
Basically I want to... (5 Replies)
Hello,
I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies
LEARN ABOUT OSF1
link
link(2) System Calls Manual link(2)NAME
link - Creates a hard link to an existing file on the local file system
SYNOPSIS
#include <unistd.h>
int link ( const char *path1, const char *path2 );
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
link(): XSH5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the pathname of an existing file. Points to the pathname for the directory entry to be created. If the path2 parameter names a
symbolic link, an error is returned.
DESCRIPTION
The link() function creates an additional hard link (directory entry) for an existing file. The old and the new link share equal access
rights to the underlying object. The link() function atomically creates a new link for the existing file and increments the link count of
the file by one.
Both the path1 and path2 parameters must reside on the same file system. A hard link to a directory cannot be created.
Upon successful completion, the link() function marks the st_ctime field of the file for update, and marks the st_ctime and st_mtime fields
of the directory containing the new entry for update.
A process must have write permission in the target directory with respect to all access control policies configured on the system.
See symlink(2) for information about making symbolic links, including Context Dependent Symbolic Links (CDSLs).
RETURN VALUES
Upon successful completion, the link() function returns a value of 0 (zero). If the link() function fails, a value of -1 is returned, no
link is created, and errno is set to indicate the error.
ERRORS
If the link() function fails, errno may be set to one of the following values: The requested link requires writing in a directory with a
mode that denies write permission, or a component of either the path1 or path2 parameter denies search permission. The requested link
requires writing in a directory to which the process does not have write access with respect to one or more of the system's configured
access policies. The directory in which the entry for the new link is being placed cannot be extended because the user's quota of disk
blocks on the file system containing the directory has been exhausted. The link named by the path2 parameter already exists. The path1 or
path2 parameter is an invalid address. [Tru64 UNIX] An I/O error occurred when updating the directory. Too many links were encountered in
translating path1 or path2. The number of links to the file named by path1 would exceed LINK_MAX. The length of the path1 or path2 string
exceeds PATH_MAX or a pathname component is longer than NAME_MAX. The file named by the path1 parameter does not exist or the path1 or
path2 parameter is an empty string. The directory in which the entry for the new link is being placed cannot be extended because there is
no space left on the file system containing the directory. A component of either path prefix is not a directory. The file named by the
path1 parameter is a directory. The requested link requires writing in a directory on a read-only file system. The link named by the
path2 parameter and the file named by the path1 parameter are on different file systems.
[Tru64 UNIX] For NFS file access, if the link() function fails, errno may also be set to one of the following values: Indicates that the
system file table is full or there are too many files currently open in the system. Indicates a stale NFS file handle. An opened file was
deleted by the server or another client; a client cannot open a file because the server has unmounted or unexported the remote directory;
or the directory that contains an opened file was unmounted or unexported by the server.
RELATED INFORMATION
Commands: link(1), unlink(1)
Functions: unlink(2), symlink(2)
Standards: standards(5) delim off
link(2)