Sponsored Content
Full Discussion: retrieve part of file path
Top Forums Shell Programming and Scripting retrieve part of file path Post 302300029 by sai21 on Monday 23rd of March 2009 03:20:55 AM
Old 03-23-2009
Code:
echo "/home/folder1/html/home/house/Home.html@@/main/" | awk -F / '{ printf ("%s/%s",$5,$6)}'


Last edited by Franklin52; 03-23-2009 at 05:23 AM.. Reason: adding code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getting the path part of an argument

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)
Discussion started by: ropers
9 Replies

2. UNIX for Dummies Questions & Answers

display full unix path as part of the command line

Hi all, Does anyone know how to ammend the .cshrc file in $HOME for your session to display the path as part of the command line? So that I dont need to keep on typing pwd to see where I am? thanks Ocelot (3 Replies)
Discussion started by: ocelot
3 Replies

3. Shell Programming and Scripting

how to retrieve a part of the word

Hi I have a word assigned to the variable, for example: A=TTOP Is there a way to remove the first letter from this word and assign the rest of the word to another variable, so the output would be like this: B=TOP Thanks a lot for any advice.... -A (2 Replies)
Discussion started by: aoussenko
2 Replies

4. Shell Programming and Scripting

regex to select last part of a path

Hi all, I am learning the use of regular expression and I would like to know which regex can be used to select only the last part of a directory path name. Something like: /dir1/dir2/dir2 and I want to select the last /dir2 where dir2 can be any kind of string. Thanks a lot for your help.... (7 Replies)
Discussion started by: elric
7 Replies

5. Shell Programming and Scripting

taking a part of string from a given path

Hi I have two path as follows system/console/bin/code/sample/testfile.txt system/console/bin/database/files/new/dbfile.txt I need the output as code/sample in first case database/files/new in second case That is I am omitting system/console/bin and the filename(s) in both... (2 Replies)
Discussion started by: ssuresh1999
2 Replies

6. UNIX for Advanced & Expert Users

How do i use vi to substitute an expression that is part of a path?

Let say I have /home/user1/bin/ and i want it to be /root/bin I tried : s/\/home\/user1/user2/ but it can't find the pattern user1. I tried: s/*\/home\/user1*/user2/ as well same result many thanks (4 Replies)
Discussion started by: c00lsnoopy
4 Replies

7. Shell Programming and Scripting

Retrieve directory path from full file path through sh

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)
Discussion started by: royzlife
7 Replies

8. Shell Programming and Scripting

Perl command to replace path part of variable

I'm trying to replace path which is part of variable inside script file: FROM: ABC_HOME=$ABC_ROOT/abc/1.0 TO: ABC_HOME=$ABC_ROOT/abc/1.5 I'm using this: perl -pi -e 's\ABC_HOME=$ABC_ROOT/abc/1.0\ABC_HOME=$ABC_ROOT/abc/1.5\g' /apps/scripts/test.sh This command is not working because... (2 Replies)
Discussion started by: djanu
2 Replies

9. Shell Programming and Scripting

How to retrieve a file from specific path using unix script?

Hi i'm new to shell script, i want to get the filename from specific location which i mentioned in my script. The scirpt should read the filename exactly using the following command "ls -ltr | tail -1". Could someone show me on this. Below is my script #!/bin/ksh PATH= /usr/ if then ... (4 Replies)
Discussion started by: fresher
4 Replies

10. UNIX for Advanced & Expert Users

A way to print only part of directory path

Hi, 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 /path/path1/path2/logs/bla/blabla /path/path1/path2/path3/logs/yadda/yadda/yadda Can someone suggest a way to make sed or other... (5 Replies)
Discussion started by: dampio
5 Replies
di_node_private_set(3DEVINFO)			       Device Information Library Functions			     di_node_private_set(3DEVINFO)

NAME
di_node_private_set, di_node_private_get, di_path_private_set, di_path_private_get, di_minor_private_set, di_minor_private_get, di_link_private_set, di_link_private_get, di_lnode_private_set, di_lnode_private_get - manipulate libdevinfo user traversal pointers SYNOPSIS
cc [ flag... ] file... -ldevinfo [ library... ] #include <libdevinfo.h> void di_node_private_set(di_node_t node, void *data); void *di_node_private_get(di_node_t node); void di_path_private_set(di_path_t path, void *data); void *di_path_private_get(di_path_t path); void di_minor_private_set(di_minor_t minor, void *data); void *di_minor_private_get(di_minor_t minor); void di_link_private_set(di_link_t link, void *data); void *di_link_private_get(di_link_t link); void di_lnode_private_set(di_lnode_t lnode, void *data); void *di_lnode_private_get(di_lnode_t lnode); PARAMETERS
node The handle to a devinfo node in a di_init(3DEVINFO) snapshot. path The handle to a path node in a snapshot. minor The handle to a minor node in a snapshot. link The handle to a link in a snapshot. lnode The handle to an lnode in a snapshot. data A pointer to caller-specific data. DESCRIPTION
The di_node_private_set() function allows a caller to associate caller-specific data pointed to by data with a devinfo node, thereby facil- itating traversal of devinfo nodes in the snapshot. The di_node_private_get() function allows a caller to retrieve a data pointer that was associated with a devinfo node obtained by a call to di_node_private_set(). The di_path_private_set() function allows a caller to associate caller-specific data pointed to by data with a devinfo path node, thereby facilitating traversal of path nodes in the snapshot. The di_path_private_get()function allows a caller to retrieve a data pointer that was associated with a path node obtained by a call to di_path_private_set(). The di_minor_private_set() function allows a caller to associate caller-specific data pointed to by data with a minor node specified by minor, thereby facilitating traversal of minor nodes in the snapshot. The di_minor_private_get() function allows a caller to retrieve a data pointer that was associated with a minor node obtained by a call to di_minor_private_set(). The di_link_private_set() function allows a caller to associate caller-specific data pointed to by data with a link, thereby facilitating traversal of links in the snapshot. The di_link_private_get() function allows a caller to retrieve a data pointer that was associated with a link obtained by a call to di_link_private_set(). The di_lnode_private_set() function allows a caller to associate caller-specific data pointed to by data with an lnode specified by lnode, thereby facilitating traversal of lnodes in the snapshot. The di_lnode_private_get() function allows a caller to retrieve a data pointer that was associated with an lnode by a call to di_lnode_pri- vate_set(). These functions do not perform any type of locking. It is up to the caller to satisfy any locking needs. RETURN VALUES
The di_node_private_set(), di_path_private_set(), di_minor_private_set(), di_link_private_set(), and di_lnode_private_set() functions do not return values. The di_node_private_get(), di_path_private_get(), di_minor_private_get(), di_link_private_get(), and di_lnode_private_get() functions return a pointer to caller-specific data that was initialized with their corresponding *_set() function. If no caller-specific data was assigned with a *_set() function, the results are undefined. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
di_init(3DEVINFO), libdevinfo(3LIB), attributes(5) SunOS 5.11 15 May 2008 di_node_private_set(3DEVINFO)
All times are GMT -4. The time now is 08:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy