Sponsored Content
Top Forums Shell Programming and Scripting Determine if variable is the Server component of UNC Post 302881501 by pravin27 on Monday 30th of December 2013 01:25:30 AM
Old 12-30-2013
Could this help you ?
Input file
Code:
$ cat server.txt
//server
//server/path1
//server/path1/path2
//server/path1/path2/filename

Invocation
Code:
$ awk -F"/" 'NF==3{print "Server Component: "$0}
NF>3{ print "Path components: "$0}' server.txt

Output
Code:
Server Component: //server
Path components: //server/path1
Path components: //server/path1/path2
Path components: //server/path1/path2/filename

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Perl to connect UNC Filepaths on Domain

I'm trying to use Perl on Windows (Doh!) to connect to a folder on a Domain Controller via UNC. Right now, I have perl -e "`runas /user:DOMAIN\\Username dir \\\\SERVER\\d\$\\Path`" This does not seem to connect nor does it prompt for password. Should I try throwing it into a script and... (0 Replies)
Discussion started by: adelsin
0 Replies

2. IP Networking

How to Determine client's DNS server Ip

Is there a way for a server to determine client's DNS ip? I have an application that logs client's IP but in certain cases its desirable to know their DNS too (1 Reply)
Discussion started by: vickylife
1 Replies

3. Shell Programming and Scripting

To verify status of particular Component(Siebel Server srvrmgr)

Hi , I want to connect srver to pertuculat mode(i.e.srvrmanger)and after that I want to verify status of perticular component(i.e.CommOutboundMgr) For that I have created following script bout after 3rd line it is not executing 4th linei.e. list comp CommOutboundMgr. cd... (2 Replies)
Discussion started by: vivek1489
2 Replies

4. Shell Programming and Scripting

Parse file name out of UNC path

Hello, I searched the forums and didn't see a situation like this: I cannot figure out how to parse out just the file name from the full path. The path looks like this: \\foo\bar\filename.ext I don't think something like 'cut' will work so I tried to whip up a regex but couldn't get it... (12 Replies)
Discussion started by: bytesnoop
12 Replies

5. Shell Programming and Scripting

Determine a shell variable exists in file?

Hi Folks, Trying to build up a script that will lookup a username invoked as: ./buildscript.sh <username> This should take <username> and look it up in <username_file> and prepare for further processing. Here is the snippet that isn't working just right: user=$1 if ]; then echo... (1 Reply)
Discussion started by: gdenton
1 Replies

6. Shell Programming and Scripting

To determine the File Sytem Usage on Multiple UNIX server

Hello All :) I want to write a shell script to find the file system usage on multiple UNIX servers. Commands: df -g fsJCAPS Below script works fine and it displays results on terminal/console. I want to store /redirect output on to local server from where I'm running the script. ... (3 Replies)
Discussion started by: Mohammad Nawaz
3 Replies

7. Red Hat

How to determine share name of Linux server?

Hi, How to determine share name of Linux server ? OS version is RHL 6.5 Regards, Maddy (11 Replies)
Discussion started by: Maddy123
11 Replies

8. Web Development

Script to determine which web server at ip addresses

how do we determine if ip addresses are hosting IIS version 7.x or Apache 2.2.x. ? (3 Replies)
Discussion started by: NameSake
3 Replies

9. Shell Programming and Scripting

Script to determine server IP

Need help with the script, I am trying to include this script as part of kickstart profile. based of the host's IP address, in this case if the host is IP starting with 10.10.3.* or 10.10.6.*, I will be pushing appropriate routing file from my web server. I validate host IP from nslookup. ... (3 Replies)
Discussion started by: bobby320
3 Replies
SYMLINK(P)						     POSIX Programmer's Manual							SYMLINK(P)

NAME
symlink - make a symbolic link to a file SYNOPSIS
#include <unistd.h> int symlink(const char *path1, const char *path2); DESCRIPTION
The symlink() function shall create a symbolic link called path2 that contains the string pointed to by path1 ( path2 is the name of the symbolic link created, path1 is the string contained in the symbolic link). The string pointed to by path1 shall be treated only as a character string and shall not be validated as a pathname. If the symlink() function fails for any reason other than [EIO], any file named by path2 shall be unaffected. RETURN VALUE
Upon successful completion, symlink() shall return 0; otherwise, it shall return -1 and set errno to indicate the error. ERRORS
The symlink() function shall fail if: EACCES Write permission is denied in the directory where the symbolic link is being created, or search permission is denied for a component of the path prefix of path2. EEXIST The path2 argument names an existing file or symbolic link. EIO An I/O error occurs while reading from or writing to the file system. ELOOP A loop exists in symbolic links encountered during resolution of the path2 argument. ENAMETOOLONG The length of the path2 argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX} or the length of the path1 argument is longer than {SYMLINK_MAX}. ENOENT A component of path2 does not name an existing file or path2 is an empty string. ENOSPC The directory in which the entry for the new symbolic link is being placed cannot be extended because no space is left on the file system containing the directory, or the new symbolic link cannot be created because no space is left on the file system which shall contain the link, or the file system is out of file-allocation resources. ENOTDIR A component of the path prefix of path2 is not a directory. EROFS The new symbolic link would reside on a read-only file system. The symlink() function may fail if: ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path2 argument. ENAMETOOLONG As a result of encountering a symbolic link in resolution of the path2 argument, the length of the substituted pathname string exceeded {PATH_MAX} bytes (including the terminating null byte), or the length of the string pointed to by path1 exceeded {SYM- LINK_MAX}. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
Like a hard link, a symbolic link allows a file to have multiple logical names. The presence of a hard link guarantees the existence of a file, even after the original name has been removed. A symbolic link provides no such assurance; in fact, the file named by the path1 argument need not exist when the link is created. A symbolic link can cross file system boundaries. Normal permission checks are made on each component of the symbolic link pathname during its resolution. RATIONALE
Since IEEE Std 1003.1-2001 does not require any association of file times with symbolic links, there is no requirement that file times be updated by symlink(). FUTURE DIRECTIONS
None. SEE ALSO
lchown() , link() , lstat() , open() , readlink() , unlink() , the Base Definitions volume of IEEE Std 1003.1-2001, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 SYMLINK(P)
All times are GMT -4. The time now is 08:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy