Iam trying to load the full path of multiplie files in the same directory to an array if the filenames matches a pattern. The following is the current code;
where $input=C:\test
The above code is only returning the last file in the directory with the full path.
What is the smartest way to just extract file name from a full path name.
e.g. if I have
/usr/sanjay/bin/file_name.c
I want only file_name.c
Sanjay (2 Replies)
hi guys
i give "ps -ef | grep some_executable_file" on the command line.
this "some_executable_file" resides on many paths which r included in the PATH environment variable, so the output depicts only "some_executable_file" in the COMMAND column. how can i get the full path?
thanx (3 Replies)
How can i list every single file on a sun solaris server running 2.8 starting from '/' with the full path included in it?
example.
/
...
...
...
/etc/inetd.conf
/etc/passwd
/etc/shadow
...
...
...
/var/adm/messages
/var/adm/messages.0
/var/adm/messages.1
...
...
...... (4 Replies)
Hi,
I have written this shell script:
fl=`ls -1lrt $mylist | grep '\.xml$' | awk '{print $9}'`
echo $fl (1)
for i in $fl
do
for dir in $mylist
do
if
then
echo $dir/$i >> tmp (2)
fi
done
done
The mylist contains some directory names. The satement (1) gives the sorted list... (5 Replies)
This has been bugging me for a while. How can i list file to show full path.
/directory/test
$ ls file.tst
file.tst
$
desired output:
/directory/test/file.tst (2 Replies)
Hi
anyone can help how put the directory in array in perl.eg directory paths below:-
/home/user/
/home/admin/
/var/log/
IF path eq /home/user/ then the files moved to /data/user/
IF path eq /var/log/ then the files moved to /data/log/
Thanks (1 Reply)
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)
Hi,
I would like to know how to grep all the paths in a file having extension .BMP
For e.g.
File Name :
sample.txt
File Content :
xxxxxxxxxxxxxxxxx
xxxxx/root/cdrive/picure.BMP xxxx
xxxxxxxxxxx
xxxxx/root/ddrive/picure.BMP xxxx
xxxxxxxxxxx
Expected Output : ... (4 Replies)
Hi
I have a requirement like this:
/abc/a/x.txt
/abc/a/y.txt
/abc/b/x.gz
/abc/b/y.txt
I need output like this:
/abc/a:*.txt
/abc/b:*.txt
/abc/b:*.gz
I have tried find /abc -type f -name "*.*" ||awk -F . '{print $NF}' it is print only extensions without path name.
Please... (5 Replies)
Discussion started by: lijjumathew
5 Replies
LEARN ABOUT DEBIAN
dpkg::path
Dpkg::Path(3) libdpkg-perl Dpkg::Path(3)NAME
Dpkg::Path - some common path handling functions
DESCRIPTION
It provides some functions to handle various path.
METHODS
get_pkg_root_dir($file)
This function will scan upwards the hierarchy of directory to find out the directory which contains the "DEBIAN" sub-directory and
it will return its path. This directory is the root directory of a package being built.
If no DEBIAN subdirectory is found, it will return undef.
relative_to_pkg_root($file)
Returns the filename relative to get_pkg_root_dir($file).
guess_pkg_root_dir($file)
This function tries to guess the root directory of the package build tree. It will first use get_pkg_root_dir(), but it will
fallback to a more imprecise check: namely it will use the parent directory that is a sub-directory of the debian directory.
It can still return undef if a file outside of the debian sub-directory is provided.
check_files_are_the_same($file1, $file2, $resolve_symlink)
This function verifies that both files are the same by checking that the device numbers and the inode numbers returned by
stat()/lstat() are the same. If $resolve_symlink is true then stat() is used, otherwise lstat() is used.
canonpath($file)
This function returns a cleaned path. It simplifies double //, and remove /./ and /../ intelligently. For /../ it simplifies the
path only if the previous element is not a symlink. Thus it should only be used on real filenames.
$newpath = resolve_symlink($symlink)
Return the filename of the file pointed by the symlink. The new name is canonicalized by canonpath().
my $cmdpath = find_command($command)
Return the path of the command if available on an absolute or relative path or on the $PATH, undef otherwise.
my $control_file = get_control_path($pkg, $filetype)
Return the path of the control file of type $filetype for the given package.
my @control_files = get_control_path($pkg)
Return the path of all available control files for the given package.
my $file = find_build_file($basename)
Selects the right variant of the given file: the arch-specific variant ("$basename.$arch") has priority over the OS-specific
variant ("$basename.$os") which has priority over the default variant ("$basename"). If none of the files exists, then it returns
undef.
my @files = find_build_file($basename)
Return the available variants of the given file. Returns an empty list if none of the files exists.
CHANGES
Version 1.03
New function: find_build_file()
Version 1.02
New function: get_control_path()
Version 1.01
New function: find_command()
AUTHOR
Raphael Hertzog <hertzog@debian.org>.
1.16.15 2014-06-05 Dpkg::Path(3)