How to get 4 digit Year using ls -l in HP-Unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to get 4 digit Year using ls -l in HP-Unix
# 1  
Old 03-03-2010
How to get 4 digit Year using ls -l in HP-Unix

I have this code that loops through a directory and adds all the files it finds in a log file.

Code:
# get list of files from FTP server; stores 
  # 'ls -l' results in $FTP_RESULTS
  (
   echo user ${FTP_USER} ${FTP_PASSWD}
   echo cd ${FULL_PATH}
   echo ls -l
   echo bye
  )|ftp -i -n $FTP_SERVER 2>&1 1> $FTP_RESULTS

this is working fine with a output like
Code:
12-04-09  02:41PM  2343044  WV20090923152200
12-04-09  02:41PM  7101       WV20090924090626

Issue:

My problem is i need four digit year instead of the two digit one.

Can some one help?
# 2  
Old 03-03-2010
# 3  
Old 03-04-2010
Quote:
Originally Posted by akabir77
I have this code that loops through a directory and adds all the files it finds in a log file.

Issue:

My problem is i need four digit year instead of the two digit one.

Can some one help?
check the man page for stat. Default is 4 digit years and the output is flexible.
# 4  
Old 03-04-2010
Thanks guys

I actually used this to solve my problem.

https://www.unix.com/unix-dummies-que...html#post16559
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print only the digit in between a line in UNIX?

Below is my content in a file. How to print only the number in between CURDEPTH( ) ?? Please help me 5724-H72 (C) Copyright IBM Corp. 1994, 2011. ALL RIGHTS RESERVED. Starting MQSC for queue manager 1 : dis ql(DUMMY.QUEUE) curdepth AMQ8409: Display Queue details. ... (1 Reply)
Discussion started by: prince1987
1 Replies

2. UNIX for Dummies Questions & Answers

Command to print previous year in UNIX

hi all, I use date +%Y which gives Current year. Requirement: I want previous year to be printed. Please help me. Note: I tried date +%d/%m/%Y -d "-1 years" which is not working. (10 Replies)
Discussion started by: wasim999
10 Replies

3. Shell Programming and Scripting

convert two digit in to single digit...

Hi Guys. My Input: ABCD 12 00 KL ABCD 12 08 DL ABCD 12 10 KK ABCD 12 04 LL ABCD 13 00 LP ABCD 13 1O LS Output: ABCD 12 0 KL ABCD 12 8 DL ABCD 12 10 KK ABCD 12 4 LL ABCD 13 0 LP (2 Replies)
Discussion started by: pareshkp
2 Replies

4. Shell Programming and Scripting

awk length of digit and print at most right digit

Have columns with digits and strings like: input.txt 3840 3841 3842 Dav Thun Tax Cahn 146; Dav. 3855 3853 3861 3862 Dav Thun Tax 2780 Karl VI., 3873 3872 3872 Dav Thun Tax 3894 3893 3897 3899 Dav Thun Tax 403; Thun 282. 3958 3959 3960 Dav Thun Tax 3972 3972 3972 3975 Dav Thun Tax... (8 Replies)
Discussion started by: sdf
8 Replies

5. Shell Programming and Scripting

how to use use /usr/bin/find for 4 digit year dirs only

I have lots of directories in ~/. My diaries are stored in directories in ~/ containing exactly 4 digits. How do I use the /usr/bin/find command to only search my diary directories? So I would like my search to include ~/2009/abc/def and ~/2010/2001/33 but not ~/103/ or ~/20101/ or ~/201/... (2 Replies)
Discussion started by: siegfried
2 Replies

6. Shell Programming and Scripting

How to convert a 2 digit to 4 digit

Hi All, How can i convert a number 24 to 0024 In the same way how can i convert 123 to 0123? All this has to be done inside a script Thanks in advance JS (6 Replies)
Discussion started by: jisha
6 Replies

7. Shell Programming and Scripting

Replace one digit by two digit using sed

Folks, Is there a simple way to replace one digit by two digit using sed. Example, mydigit1918_2006_8_8_lag1.csv should be mydigit1918_2006_08_08_lag01.csv. I tried this way, but doesn't work. echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/' Thank you, (5 Replies)
Discussion started by: Jae
5 Replies

8. What is on Your Mind?

Happy New Year 2008 from The UNIX Forums!

Dear Everyone, Thank you so much for making 2007 a great year for The UNIX Forums. Great posts, super moderation, and fantastic admins. A special word of appreciation to Perderabo and Reborg for all they do for everyone here. We may not be the biggest forum on the planet, but we have... (1 Reply)
Discussion started by: Neo
1 Replies

9. UNIX for Advanced & Expert Users

how to get the last month and year in UNIX

how to get the last month and year in UNIx (2 Replies)
Discussion started by: Vijay06
2 Replies
Login or Register to Ask a Question