Sponsored Content
Top Forums Shell Programming and Scripting getting part of directory after a certain / Post 302627825 by vanessafan99 on Sunday 22nd of April 2012 01:40:39 AM
Old 04-22-2012
getting part of directory after a certain /

i have a directory like this:

i want to get the subpaths:
/home/user/public_html/a/b
subpath= a/b

/home/user/public_html/a/b/c
subpath= a/b/c


i can get the user like
Code:
echo $fulldirectory |awk -F/ '{print $3}'

but im not sure how to get the rest of it after public_html

any ideas?
thanks!
Moderator's Comments:
Mod Comment Link: How to use code tags

Last edited by Scrutinizer; 04-22-2012 at 03:00 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

current directory as part of the csh prompt

I would like my csh prompt to behave like the linux csh prompt setting done by linux command (set prompt="%n@%m %c]$ ") how do I do that? What I'm trying to do is that I would like to see what directory I'm in by looking at the prompt. I've figured out that %n is like $user, and %m is like... (3 Replies)
Discussion started by: jamesloh
3 Replies

2. Shell Programming and Scripting

Bash: How to get part of the directory name?

How can I write a script that determines the directory the user is in, and displays that path up until a particular point? Specifically, I need to find the text "packages" in the directory name, then I need to capture that directory and the one below it. For example, if the user is in the... (5 Replies)
Discussion started by: RickS
5 Replies

3. Shell Programming and Scripting

listing Directory chronologically based on part of file name

hi Everbody, I had file names as shown file_01_20101104.txt file_01_20101105.txt file_02_20101104.txt file_01_20101205.txt file_03_20101104.txt file_02_20101105.txt Now i want to list them based on the date in the file name as shown... file_01_20101104.txt file_02_20101104.txt... (3 Replies)
Discussion started by: Reddy482
3 Replies

4. UNIX for Dummies Questions & Answers

Remove part of file names in a directory

Hi, i have a directory full of pictures, .jpg files. Half of them begin with "beach_" (for ex beach_123_123456.jpg) i'm looking for a command to remove the "beach_" from all files in the directory. thanks (4 Replies)
Discussion started by: robertmanalio
4 Replies

5. UNIX for Dummies Questions & Answers

Renaming files with part of their pathname and copying them to new directory

Hi I think this should be relatively simple but I can't figure it out. I have several files with the same name in different folders within a directory (the output of a program that I ran). Something like this: ./myAnalysis/item1/round1/myoutput.txt ./myAnalysis/item1/round2/myoutput.txt... (2 Replies)
Discussion started by: jullee
2 Replies

6. Shell Programming and Scripting

Selecting/using part of directory names in script

I'm making a shell script to: -copy directories to a new location -perform conversions on the files within the copied directories -move the newly created files to a new directory Please see my super basic script and notes below... and thank you thank you thank you in advance !! ... (1 Reply)
Discussion started by: kayzee
1 Replies

7. Shell Programming and Scripting

Add part of directory name to filename

Hello, I need to add a part of folder name to the files inside it. For instance the file is HMCBackup_20150430.155027.tgz and it is under directory /nim/dr/HMCBackup/cops22 I need to add cops22 to the file name so as it would be cops22_HMCBackup_20150430.155027.tgz Any help in doing... (10 Replies)
Discussion started by: hasn318
10 Replies

8. 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

9. UNIX for Advanced & Expert Users

Linux cant cd into directory and part of group

I am part of the group group1. The directory permission I am trying to cd into are 770 for both the parent directory and child directory but I still can not cd into. What am I doing wrong? $ ls -l /NAS/infa/ drwxrwxr-x. 22 user1 group1 506 Jun 6 17:05 infa_shared $... (5 Replies)
Discussion started by: cokedude
5 Replies
HTMAKE(1)						       GLOBAL cgi Utilities							 HTMAKE(1)

NAME
htmake - create GLOBAL hypertext source searchable by gsearch.cgi SYNOPSIS
htmake [htags options] [--url=base-url] [destdir] DESCRIPTION
htmake is a wrapper script that creates searchable hypertext from program source code and records information into a path database needed for a centralised search mechanism. Prior to using this command you must have installed gsearch.cgi using the htconfig -I option and configured the location of the path data- base in htmake.conf Before you can create the hypertext source you need to execute gtags(1) from the root directory of the source tree. htmake is then called from the same place. htmake uses htags(1) to create the hypertext with a unique id and htconfig(1) to make the required entries in the path database. OPTIONS
The following options will be passed to htags(1) if used. -a Make an alphabetical function index. -c Compress html. Use gzip(1) with .ghtml suffix. -C Compress html. Use gzip(1) with .html.gz suffix. -d tagdir, --tags=gtagsdbpath Specifies the directory in which GTAGS and GRTAGS exist. The default is the current directory. -F Use frames for definition index, file index and main view. -l Make a name tag for each line of hypertext created. -n Print out the line numbers. -t title The title of this hypertext. Defaults to the last component of the current path. --action=cgi-url Specify the location search queries are submitted to. Defaults to the value set in htmake.conf or to http://localhost/cgi-bin/gsearch.cgi The remaining options are more general or are passed to htconfig(1). --url=base-url the base url for your new hypertext source. For best results always use absolute url's here. eg. http://host/~user/mysource It defaults to file:/destdir destdir The directory in which hypertext is generated. The default is ./HTML -v, --verbose Activate the inbuilt screen saver. Give your phosphors a workout. EXAMPLES
$ cd /usr/src/myprog $ gtags $ htmake $ cd /usr/src/myprog $ gtags -c $ htmake -c --url=http://host/~user/prog/HTML /home/user/public_html/prog FILES
/etc/gtags/htmake.conf path database BUGS
As a wrapper htmake gets to inherit bugs from other software too. Isn't life fun. This is alpha software - expect anything! SEE ALSO
htconfig(1), htags(1), gtags(1), global(1). AUTHOR
Ron Lee <ron@debian.org> CREDITS
Thanks to Shigio Yamaguchi <shigio@gnu.org> for creating GLOBAL and releasing it as free software. A truly cool productivity tool! Debian GNU/Linux 27 March 1999 HTMAKE(1)
All times are GMT -4. The time now is 03:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy