Sponsored Content
Full Discussion: List year for a Folder
Operating Systems HP-UX List year for a Folder Post 302831501 by vidyadhar85 on Thursday 11th of July 2013 05:12:12 AM
Old 07-11-2013
Behaviour of ls is such that the year is displayed only for files older than 6 months. If you want the year for files less than 6 months old, you will have to write a program either in C/perl/python that does the task.

if you have --time-style in your ls man page you can display year with ls --full-time

perl command..

Code:
 
perl -e '@d=localtime ((stat(shift))[9]); printf "%02d-%02d-%04d %02d:%02d:%02d\n", $d[3],$d[4]+1,$d[5]+1900,$d[2],$d[1],$d[0]' file


Last edited by vidyadhar85; 07-11-2013 at 06:18 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Command to list samba shared folder in linux

Hi All, Is there any command to list samba shared folders in red hat linux 7.2 Thanks in advance Bache Gowda (0 Replies)
Discussion started by: bache_gowda
0 Replies

2. Shell Programming and Scripting

trying to list everything in a folder except . and ..

I want to list everything in a directory, including dotfiles (example .file1) except for the . and .. that are in every folder. I'm guessing it's some sort of regular expression I need. So far, I have come up with ls -a | grep That lists the .file1 file only (though I don't see why it should,... (2 Replies)
Discussion started by: dkieran
2 Replies

3. Shell Programming and Scripting

Need year to display from ftped files list

Hi All, p_ftp=dummy time ftp -niv 192.0.0.2 << EOF user dummy dummy cd prt/$p_ftp ascii ls -ltr quit output is -rw-r--r-- 1 500 500 5137 Mar 04 11:21 dummy.csv can any one suggest how to get year while using ftp (1 Reply)
Discussion started by: Vrgurav
1 Replies

4. UNIX for Dummies Questions & Answers

List certain file in a folder and make list

Hi, im having problem that frustate me today. there are list of file in a folder that i want to grab the folder /subject/items/ in this folder there are this file CREATE_SUBxxxx.xml UPDATE_SUBxxxx.xml DELETE_SUBxxxx.xml loginresponsexxxxx.xml core how can i grab all the file... (1 Reply)
Discussion started by: andrisetia
1 Replies

5. UNIX for Dummies Questions & Answers

dtterm to list a folder contents in new window

Hi everyone,:cool: thank you in advance for any help on this I have a dtterm command to open a new small terminal window with a contents of log, and it works fine. dtterm -title "my.log" -geometry =40x30+0+550 -fn 6x13 -e tail -n 40 -f /home/logs/user.log & However what I want to do... (4 Replies)
Discussion started by: golfcents
4 Replies

6. Shell Programming and Scripting

List of files in a folder inclusive subfolder

Hi, I need to list the names of existing files in a specific folder. I have written a script for that, but the problem is, it is also picking up name of a subfolder that is there in that folder. I need only the list of files and not that subfolder. How to go about that ? Can anyone plz help... (2 Replies)
Discussion started by: Subhasis
2 Replies

7. UNIX for Dummies Questions & Answers

Unable to list folder contents

I'm unable to list the contents of a directory once I move into it. I have full permissions on this directory (called "Scripts" in the below example). The scenario is shown below in detail: Command 'ls' works fine to begin with: 1: pmn@linuxhost /home/pmn > cd /opt/smt/proiv 2:... (4 Replies)
Discussion started by: pmn
4 Replies

8. UNIX for Beginners Questions & Answers

How to list todays file in perticular folder?

How to list todays file in perticular folder Moved thread to appropriate forum (9 Replies)
Discussion started by: pspriyanka
9 Replies

9. Shell Programming and Scripting

Find the owner user of each folder in a list

Hello I have a file containing the list of different folders like this file_list.txt: /s8/tests/test1 /s8/tests/tests/test2 /s8/tests/test2 /s8/tests/tests/test2/test5 I want a script to put the owner user of each folder in front of it in the text file. So the reult would become... (5 Replies)
Discussion started by: Johanni
5 Replies
VFPRINTF(3)								 1							       VFPRINTF(3)

vfprintf - Write a formatted string to a stream

SYNOPSIS
int vfprintf (resource $handle, string $format, array $args) DESCRIPTION
Write a string produced according to $format to the stream resource specified by $handle. Operates as fprintf(3) but accepts an array of arguments, rather than a variable number of arguments. PARAMETERS
o $handle - o $format - See sprintf(3) for a description of $format. o $args - RETURN VALUES
Returns the length of the outputted string. EXAMPLES
Example #1 vfprintf(3): zero-padded integers <?php if (!($fp = fopen('date.txt', 'w'))) return; vfprintf($fp, "%04d-%02d-%02d", array($year, $month, $day)); // will write the formatted ISO date to date.txt ?> SEE ALSO
printf(3), sprintf(3), sscanf(3), fscanf(3), vsprintf(3), number_format(3). PHP Documentation Group VFPRINTF(3)
All times are GMT -4. The time now is 02:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy