Sponsored Content
Top Forums Shell Programming and Scripting How to parse filename and one level up directory name? Post 302460884 by Shirisha on Thursday 7th of October 2010 11:01:48 PM
Old 10-08-2010
How to parse filename and one level up directory name?

Hello Experts,

I need little help with parsing.
I want to parse filename and one level up directory name.
sample $1 will consists of
/home/username/ABC1/rstfiles4.log
/home/username/ABC4/rstfiles2.log
/home/username/EDC7/rstfiles23.log
/home/username/EDC6/rstfiles55.log
/home/username/rstfiles15.log

So in this i want to parse like
ABC,rst*.log
EDC,rst*.log
,rst.log

Please help me to get this output.

Thanks in advance!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

2. Shell Programming and Scripting

How to exclude top level directory with find?

I'm using bash on cygwin/windows. I'm trying to use find and exclude the directory /cygdrive/c/System\ Volume\ Information. When I try to use the command below I get the error "rm: cannot remove `/cygdrive/c/System Volume Information': Is a directory. Can someone tell me what I am doing... (3 Replies)
Discussion started by: siegfried
3 Replies

3. Shell Programming and Scripting

Parse and replace string in filename

Hi, I've a filename of this format: "XXX_XXX_TXT.TAR.AS". Need to change the name into this format: "XXX_XXX.TAR.AS". This file resides in a directory. I'm ok with using the find command to search and display it. Essentially I just need to replace the string "_TXT.TAR.AS" to ".TAR.AS". Is awk... (17 Replies)
Discussion started by: chengwei
17 Replies

4. UNIX for Dummies Questions & Answers

awk to parse a directory name?

Hi, I have a directory file name: /auto/space/user/jen/CED/CED_01MZ/visit1/DCE_2eco/016/echo1 I would like to just get the following outputs into variables such that: variable1 = /auto/space/user/jen/CED/CED_01MZ/visit1/ and variable2 = DCE_2eco/016/echo1 I've tried it with... (2 Replies)
Discussion started by: nixjennings
2 Replies

5. Shell Programming and Scripting

Parse files in directory and compare with another file

I have two files File 1 in reading directory is of following format Read 1 A T Read 3 T C Read 5 G T Read 7 A G Read 10 A G Read 12 C G File 2 in directory contains Read 5 A G Read 6 T C Read 7 G A Read 8 G A Read 20 A T File2 contains (1 Reply)
Discussion started by: empyrean
1 Replies

6. Shell Programming and Scripting

How to get top level parent directory

Hi All, I have a directory like this: /u01/app/oracle/11gSE1/11gR203 How do i get the top level directory /u01 from this? Tried dirname and basename but dint help. I can this using echo $ORACLE_HOME | awk -F"/" '{print "/"$2}'. But I am trying to find out if there is a better way of doing it... (4 Replies)
Discussion started by: nilayasundar
4 Replies

7. Web Development

.htaccess allow at directory level

Hi Guys I have a web a site at the following directory /var/www/ the website is containing a lot of sub directories. /var/www/mywebsite/folder1 /var/www/mywebsite/folder2 /var/www/mywebsite/folder3 I would like to block all the website expect one user ex: user1 password1 who can see... (3 Replies)
Discussion started by: molwiko
3 Replies

8. UNIX for Beginners Questions & Answers

Move all files one directory level up

I want to move all the files in a given directory up one level. For example: Dir1 Subdir1 I want to move all the files in Subdir1 up to Dir1 (then I want to ultimately delete Subdir1) Thanks, Ted (10 Replies)
Discussion started by: ftrobaugh
10 Replies

9. UNIX for Beginners Questions & Answers

Bash script - Remove the 3 top level of a full path filename

Hello. Source file are in : /a/b/c/d/e/f/g/some_file Destination is : /d/e where sub-directories "f" and "g" may missing or not. After copying I want /a/b/c/d/e/f/g/file1 in /d/e/f/g/file1 On source /a is top-level directory On destination /d is top-level directory I would like... (2 Replies)
Discussion started by: jcdole
2 Replies

10. Shell Programming and Scripting

Parse Directory path - awk

Hi All, Need some help in parsing a directory listing .. output into 2 files Input file level1,/level2/level3/level4/ora001,10,IBB23 level1,/level2/level3/level4/ora001/blu1,,IBB23 level1,/level2/level3/level4/ora001/clu1,,IBB23 level1,/level2/level3/level4/ora002,,IBB24... (10 Replies)
Discussion started by: greycells
10 Replies
GFUSER(1)																 GFUSER(1)

NAME
gfuser - Gfarm user maintenance command SYNOPSIS
gfuser [ -P path ] [ -l ] [ user ... ] gfuser [ -P path ] -c username realname homedir gsi_dn gfuser [ -P path ] -m username realname homedir gsi_dn gfuser [ -P path ] -d username DESCRIPTION
gfuser manages Gfarm global users in Gfarm file system. Default action displays all registered users. When user names are specified, specified users are displayed. Gfarm administrator can creates, modifies, and deletes a Gfarm user by -c, -m, and -d options, respec- tively. OPTIONS
-P path This option specifies a pathname or a Gfarm URL to identify a metadata server which will be accessed by this command. If not speci- fied, "/" is used as the default value. -l Displays verbose information of registered users. -c Creates a user by specifying a global username in Gfarm file system, a real username, a home directory in Gfarm, and a Subject DN used in GSI. When the real username or the Subject DN includes spaces, it is needed to be quoted. This option can be used by Gfarm administrators. -m Replaces a user information of the specified global user with specified real name, home directory and Subject DN. This option can be used by Gfarm administrators. -d Deletes a registered user. This option can be used by Gfarm administrators. -? Displays a list of command options. SEE ALSO
gfgroup(1) Gfarm 20 January 2010 GFUSER(1)
All times are GMT -4. The time now is 04:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy