List the directories, having given pattern in the directories name, sorted by creation date
It is for HP-Unix B.11.31.
Requirement:
1. List the directories, having given pattern in the directories name, sorted by creation date.
Example: Directories with name "pkg32*" or "pkg33*"
2. On the output of 1. list the directories by creation date as sort order, with creation date display in mm/dd/yyyy format
I tried with;
Code:
find ./ -name "pkg3[23]*" -type d | xargs ls -ld
find ./ -name "pkg3[23]*" -type d -exec ls -ld {} \; | awk '{print $6,$7,$8,$9}'
But I want the output to be sorted with creation date;
Code:
$ find ./ -name "pkg3[2]*" -type d -exec ls -ld {} \; | awk '{print $6,$7,$8,$9}'
Oct 24 2012 ./pkg320.0_20121025_mrg
Oct 25 2012 ./pkg320.0_20121025_fix
Oct 31 2012 ./pkg320.0_20121101
Oct 31 2012 ./pkg320.0_20121101_ret
Nov 4 2012 ./pkg320.0_dev02_20121104
Nov 7 23:24 ./pkg320.0_20121108
Nov 13 19:57 ./pkg320.0_20121114
Nov 29 13:56 ./pkg320.0_20121004_prof
Nov 29 13:56 ./pkg320.0_20121129_fix
Nov 28 14:42 ./pkg320.0_20121101_prof
Nov 28 14:43 ./pkg320.0_20121108_prof
Nov 29 15:31 ./pkg320.0_20121129_fix1
Dec 7 12:51 ./pkg321.0_20121207_56
Dec 11 15:06 ./pkg321.0_20121211_CR5875
Dec 4 21:48 ./pkg321.0_20121205
Dec 11 23:03 ./pkg321.0_20121212
Dec 11 23:05 ./pkg321.0_20121212_ret
Dec 14 11:02 ./pkg321.0_20121214_CR_fix
Dec 17 09:53 ./pkg321.0_20121217_fix
Dec 17 10:08 ./pkg321.0_20121216_fix
Dec 19 15:57 ./pkg321.0_20121219
Dec 31 23:50 ./pkg322.0_20130102
Jan 9 09:56 ./pkg322.0_20130109
Jan 9 09:57 ./pkg322.0_20130109_ret
Jan 11 11:28 ./pkg322.0_20130111_fix
Jan 16 10:41 ./pkg322.1_20130116_ret
Jan 23 21:12 ./pkg322.3_20130124
Feb 12 22:18 ./pkg322.6_20130212_ret
Mar 19 16:30 ./pkg321.0_20121205_prof
Mar 19 17:51 ./pkg321.0_20121212_prof
Mar 19 18:32 ./pkg322.0_20130102_prof
May 1 2012 ./pkg320.0_dev02_20120205
May 1 2012 ./pkg320.0_dev02_20120401
Jul 6 2012 ./pkg320.0_dev02_20120708
Aug 3 2012 ./pkg320.0_dev02_20120805
I have a folder structure like the below
/test/test1/test2/app
/test/test3/app
/test/test4/test5/app
..
I need to create a new folder under "app" in all the above listed directory structure at one shot by the name "subapp" .
How can we acheive this using a script .
New to unix... (4 Replies)
Hi ,
I am very new to unix as well as shell scripting. I have to write a script for the following requirement.
In a particular mount, have to list all the directories and sub directories along with size of the directory and sub directory in ascending order.
Please help me in this regard and many... (4 Replies)
Hi,
Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process.
I wanted to disply using a unix command all the directories recursively excluding files.
I tried 'ls -FR' but that display files as... (3 Replies)
It is for HP-Unix B.11.31.
Requirement:
1. List the directories, which directories name has given particular string.
Example: Directories with name "Build"
2. On the output of 1. list the directories by creation date as sort order.
I tried with; find . -type d -name "Build*"
... (3 Replies)
Hi all,
Using grep command, i want to find the pattern of text in all directories and sub-directories.
e.g: if i want to search for a pattern named "parmeter", i used the command
grep -i "param" ../*
is this correct? (1 Reply)
I am trying to link 2 directories using:
ln -s /net/<hostname>/srcdir/ /net/<desthostname>/dstdir/
I get the following error:
ln: /net/<desthostname>/dstdir: Function is not available
What is it that i am trying to do wrongly in the above operation?
Please use next time code tags (3 Replies)
I have a top-level directory called work and I would like to create subdirectories work1 work2... under this directory. Also I would like to create subdirectory under work1 -- test, work2 -- test etc., Can I automate this using a command-line script?
work
|_work 1
|_test
|_work 2
... (2 Replies)
Can anyone come up with a unix command that lists
all the files, directories and sub-directories in the current directory
except a folder called log.?
Thank you in advance. (7 Replies)
i am having trouble creating a directory with last months date as the folder name.
what i am using is echo `date +%b%y`
which gives
Mar14 as the result but i want to get Feb14 as the result.:wall: (6 Replies)
What I know so far:
ls -A will list all files except those starting with a dot
ls -d will list all directories
ls -m will separate contents by commas
For getting crtimes use:
stat filename will give me the inode number
or
ls -i filename will give... (13 Replies)
Discussion started by: chstewar
13 Replies
LEARN ABOUT DEBIAN
function::ctime
function::ctime
FUNCTION:(3stap) Time utility functions FUNCTION:(3stap)NAME
function::ctime - Convert seconds since epoch into human readable date/time string
SYNOPSIS
ctime:string(epochsecs:long)
ARGUMENTS
epochsecs
Number of seconds since epoch (as returned by gettimeofday_s)
DESCRIPTION
Takes an argument of seconds since the epoch as returned by gettimeofday_s. Returns a string of the form
"Wed Jun 30 21:49:08 1993"
The string will always be exactly 24 characters. If the time would be unreasonable far in the past (before what can be represented with a
32 bit offset in seconds from the epoch) the returned string will be "a long, long time ago...". If the time would be unreasonable far in
the future the returned string will be "far far in the future..." (both these strings are also 24 characters wide).
Note that the epoch (zero) corresponds to
"Thu Jan 1 00:00:00 1970"
The earliest full date given by ctime, corresponding to epochsecs -2147483648 is "Fri Dec 13 20:45:52 1901". The latest full date given by
ctime, corresponding to epochsecs 2147483647 is "Tue Jan 19 03:14:07 2038".
The abbreviations for the days of the week are 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', and 'Sat'. The abbreviations for the months are
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', and 'Dec'.
Note that the real C library ctime function puts a newline ('
') character at the end of the string that this function does not. Also note
that since the kernel has no concept of timezones, the returned time is always in GMT.
SystemTap Tapset Reference May 2013 FUNCTION:(3stap)