Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to get dir name tacked onto filename with ls command Post 302148245 by denn on Friday 30th of November 2007 10:55:17 AM
Old 11-30-2007
Not certain you can do that directly with ls, or why that would be necessary, however you can get the output you want other ways.

assuming ksh as your shell.

Code:
DIR=`dirname $PWD`
BASE=`basename $PWD`

 for i in *
 do
    echo ${DIR}/${BASE}/$i | tee -a /tmp/outt
 done

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Using the ps command from ucb dir

On a Sun OS system we have, when executing a ps command it displays a third parties applications password. The ps command used is from the ucb dir, but if you use the ps command which resides in the bin dir it doesn't display the password. Other users need to use the ps command from the ucb... (2 Replies)
Discussion started by: dbrundrett
2 Replies

2. UNIX for Advanced & Expert Users

command 'touch -c file/dir'

Dear expert, what is this command touch -c filename using for? I find if execute and filename is existed, it update the date to now. If the filename is not exeisted, it don't create the file.. so what is this command using for? Thank a lot! (1 Reply)
Discussion started by: zp523444
1 Replies

3. Shell Programming and Scripting

Print filename and resolution in wrkng dir

Greetings, I am trying to write script, (preferably in sh) that will use a proprietary program to print the resolution and name of files in the current working directory in a vertical format. I think this script will require 3 commands with variables and a pipe to the prop program, but am not... (6 Replies)
Discussion started by: rocinante
6 Replies

4. UNIX for Dummies Questions & Answers

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (2 Replies)
Discussion started by: Sriranga
2 Replies

5. Shell Programming and Scripting

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (4 Replies)
Discussion started by: Sriranga
4 Replies

6. Shell Programming and Scripting

Using DIR command in FTP

Hi, Can the below command will be working in FTP dir */*/*/*.zip I want to dynamically know the folder names where the zipfiles are present. Thnx in advance. (1 Reply)
Discussion started by: weknowd
1 Replies

7. Shell Programming and Scripting

Run command on each and every logs of dir

HI i have below command and i want to run it on each logs of each and every Dir. /home/Laco/Al I have sub dir in this folder /home/Laco/Al/04092012/LP/X/*.logs /home/Laco/Al/04092012/LP/Y/*.logs /home/Laco/Al/04092012/LP/Z/*.logs /home/Laco/Al/04092012/LP/P/*.logs I want to run... (5 Replies)
Discussion started by: asavaliya
5 Replies

8. Windows & DOS: Issues & Discussions

Check dir for overly path+filename and list in txt

Well since Windows always laments over some of my files having a too long "path+filename" and it gets in the way of copying complete directory structures I would love to have a DOS Script that helps me with finding those. I already tried DCSoft Long Filename Finder but that is neither DOS based... (3 Replies)
Discussion started by: pasc
3 Replies

9. Shell Programming and Scripting

Print filename/dir name while executing aclput using find command

Running below command , but unable to print the filename , is there way to print filename/dirname using -print option find . -type f -exec aclput -i fileacl.template {} \; (5 Replies)
Discussion started by: lalitpct
5 Replies

10. Shell Programming and Scripting

How to get a value from a file and serach that value filename in a dir?

buddies, my requirement would be as follows, I have a file called test.txt and content of it would be yahoo gmail hotmail and i want to search a file name called "yahoo.html" (first line of test.txt) and then "gmail.html" and then "hotmail.html" in a /home/test dir. Any idea... (8 Replies)
Discussion started by: natraj005
8 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgawk | +--------------------+-----------------+ |Interface Stability | Volatile | +--------------------+-----------------+ NOTES
Source for gawk is available on http://opensolaris.org. Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy