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
WATCHGNUPG(1)							 GNU Privacy Guard						     WATCHGNUPG(1)

NAME
watchgnupg - Read and print logs from a socket SYNOPSIS
watchgnupg [--force] [--verbose] socketname DESCRIPTION
Most of the main utilities are able to write their log files to a Unix Domain socket if configured that way. watchgnupg is a simple lis- tener for such a socket. It ameliorates the output with a time stamp and makes sure that long lines are not interspersed with log output from other utilities. This tool is not available for Windows. watchgnupg is commonly invoked as watchgnupg --force ~/.gnupg/S.log OPTIONS
watchgnupg understands these options: --force Delete an already existing socket file. --tcp n Instead of reading from a local socket, listen for connects on TCP port n. --verbose Enable extra informational output. --version Print version of the program and exit. --help Display a brief help page and exit. EXAMPLES
$ watchgnupg --force /home/foo/.gnupg/S.log This waits for connections on the local socket '/home/foo/.gnupg/S.log' and shows all log entries. To make this work the option log-file needs to be used with all modules which logs are to be shown. The value for that option must be given with a special prefix (e.g. in the conf file): log-file socket:///home/foo/.gnupg/S.log For debugging purposes it is also possible to do remote logging. Take care if you use this feature because the information is send in the clear over the network. Use this syntax in the conf files: log-file tcp://192.168.1.1:4711 You may use any port and not just 4711 as shown above; only IP addresses are supported (v4 and v6) and no host names. You need to start watchgnupg with the tcp option. Note that under Windows the registry entry HKCUSoftwareGNUGnuPG:DefaultLogFile can be used to change the default log output from stderr to whatever is given by that entry. However the only useful entry is a TCP name for remote debugging. SEE ALSO
gpg(1), gpgsm(1), gpg-agent(1), scdaemon(1) The full documentation for this tool is maintained as a Texinfo manual. If GnuPG and the info program are properly installed at your site, the command info gnupg should give you access to the complete manual including a menu structure and an index. GnuPG 2.0.19 2014-06-26 WATCHGNUPG(1)
All times are GMT -4. The time now is 01:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy