Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Extract directory name from the full directory path in UNIX using shell scripting Post 302904384 by IshuGupta on Tuesday 3rd of June 2014 07:18:39 PM
Old 06-03-2014
Great...it absolutely looks like a machine language. Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sorting by Full directory path

I have a text file with full list of files with their full path. I wanted to sort it by directory then files then subdirectory by alphabetically. When I used the sort command it doesn't give like what I want. Could somebody help me on this. Here is the ex: This is what I'm getting... (2 Replies)
Discussion started by: javidraaj
2 Replies

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

3. Shell Programming and Scripting

How to extract strings from full path when full path is not fixed

/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message. /Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies

4. UNIX for Dummies Questions & Answers

Present Working Directory (not the full path)

Hi, Is there a command that tells you right away the current working directory? I know the command "pwd", but that one gives the full path. if pwd gives me: /a/b/c/d/ggg/HERE I want something that will give me: HERE Thanks, Gaurab (13 Replies)
Discussion started by: gaurab
13 Replies

5. Shell Programming and Scripting

How do I get an ls -l to not show the full directory path?

Hey I'm new to the forums here, and I'm seeking help for this script that I'm writing. When I do ls -l of a directory it shows the full pathname for files in it. For example, if the directory is /internet/post/forum/ and the file is topic, it currently shows internet/post/forum/topic. What's the... (3 Replies)
Discussion started by: unity04
3 Replies

6. Shell Programming and Scripting

$0 doesn't have full directory path

I'm running AIX unix korn shell. If I echo $0, I only get the filename, it does not have the directory name also. So when I do: `dirname $0` it returns a . (meaning current directory). How get $0 to return the full path/filename? Do I need something in my .profile? Thank you. (8 Replies)
Discussion started by: sboxtops
8 Replies

7. Shell Programming and Scripting

How to list all Subdirectories and files with its full path in a parent directory?

How to list all Subdirectories and files with its full path in a parent directory? (1 Reply)
Discussion started by: johnveslin
1 Replies

8. UNIX for Dummies Questions & Answers

Extract directory from full file name?

I think I know what this is doing, but the 'eval' is confusing fname=$(echo ${lineItem} | awk 'BEGIN {FS=";"}{print $1}') fname=${fname%%+(])} fname=${fname##+(])} eval "fname=${fname}" The first line extracts the contents of the line preceeding the ";" 2nd & 3rd lines trim the value (I... (5 Replies)
Discussion started by: jdorn001
5 Replies

9. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

10. UNIX for Beginners Questions & Answers

Extract directory path from a parameter

i was attempting to extract a directory path that was passed from a parameter with this code vdir=`dirname $p1` echo current directory $vdir it does not work when the parameter passed has wild card on it. for example $ sh sample1.sh "/sbin/log/c*.log" dirname: extra operand... (2 Replies)
Discussion started by: wtolentino
2 Replies
IFIND(1)						      General Commands Manual							  IFIND(1)

NAME
ifind - Find the meta-data structure that has allocated a given disk unit or file name. SYNOPSIS
ifind [-avVl] [-f fstype] [-d data_unit] [-n file] [-p par_inode] [-z ZONE] [-i imgtype] [-o imgoffset] [-b dev_sector_size] image [images] DESCRIPTION
ifind finds the meta-data structure that has data_unit allocated a data unit or has a given file name. In some cases any of the structures can be unallocated and this will still find the results. ARGUMENTS
There are several required and optional arguments. The image file names must be specified each time: image [images] One (or more if split) disk or partition images whose format is given with '-i'..PP You must also specify what you are looking for and include one of the following: -d data_unit Finds the meta data structure that has allocated a given data unit (block, cluster, etc.) -n file Finds the meta data structure that is pointed to by the given file name. -p par_inode Finds the unallocated MFT entries in an NTFS image that have the given inode as the parent. Can be used with '-l and -z'. There are also several optional arguments: -a Find all meta-data structures (only works when looking with a data_unit). -f fstype Specify the file system type. Use '-f list' to list the supported file system types. If not given, autodetection methods are used. -l List the details of each file found with '-p', like 'fls -l'. -i imgtype Identify the type of image file, such as raw or split. Use '-i list' to list the supported types. If not given, autodetection methods are used. -o imgoffset The sector offset where the file system starts in the image. -b dev_sector_size The size, in bytes, of the underlying device sectors. If not given, the value in the image format is used (if it exists) or 512-bytes is assumed. -v Verbose output to stderr. -V Display version. -z ZONE If '-p -l' were given, this will set the timezone for the correct times. EXAMPLES
# ifind -f fat -d 456 fat-img.dd # ifind -f linux-ext2 -n "/etc/" linux-img.dd # ifind -f ntfs -p 5 -l -z EST5EDT ntfs-img.dd AUTHOR
Brian Carrier <carrier at sleuthkit dot org> Send documentation updates to <doc-updates at sleuthkit dot org> IFIND(1)
All times are GMT -4. The time now is 01:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy