![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| search by modified date | kotasateesh | Shell Programming and Scripting | 4 | 06-24-2008 06:59 AM |
| How to list files that were added or modified on a certain date? | thoughts | UNIX for Dummies Questions & Answers | 8 | 02-19-2008 10:44 PM |
| greping certain modified date | ali560045 | Shell Programming and Scripting | 2 | 02-08-2008 04:54 AM |
| Create a list of files that were modified after a given date. | rkka | UNIX for Dummies Questions & Answers | 4 | 01-22-2008 02:12 AM |
| How do I get the last modified date of a file? | akpopa | UNIX for Dummies Questions & Answers | 2 | 08-29-2001 12:08 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
I don't know what OS you are on, but an easy and ALWAYS working way to get the last modification date is to do an "ls -l".
Having said this, the following line should give you the desired result for a file (replace "<space>" with literal spaces and <filename> with the filename): Code:
ls -l <filename> | sed 's/<space><space>*/<space>/g' | cut -d'<space>' -f6,7 To put the extracted data into your HTML file you will need this plus some HTML-Tags surrounding it, namely "<TD>" and "</TD>". The following should do the trick: Code:
chFileDate="$( ls -l <filename> |\
sed 's/<space><space>*/<space>/g' |\
cut -d'<space>' -f6,7 \
)"
print - "<TD> $chFileDate </TD>" | tee -a $HTMLFILE
bakunin |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
it doesnt work
Code:
modiDate = "$( ls -al $PFAD$DR | sed 's/ */ /g* | cut -d ' ' -f6,7)" |
|
#10
|
|||
|
|||
|
Yeah
I have solved this problem problem with Code:
ls -al $PFAD$DR | awk '{printf("<TD>%s %s %s\n", $6, $7, $8)}' | tee -a $HTMLFILE
it print's Feb 22 10:48 i want '17. Jan 2005' how can i solve this one |
|
#11
|
||||
|
||||
|
try
Code:
ls -l --time-style="long-iso" or ls -l --time-style="+%e,%b %Y" |
|
#12
|
|||
|
|||
|
Quote:
Your awk solution is not really recommendable, because you call awk several times for every table row and perhaps nested in a loop to print several rows only to do a formatted print which can be done directly in the shell. Maybe your environment has enough unused computing power to allow for that, but in principle this is a waste of resources. It may be that I'm old-fashioned, but I learned that a good solution is not one that works but one that works and is efficient and elegant. Computing power or any other resource should never be taken for granted and neither wasted if it could be conserved. Ok, I'm already through ranting..... bakunin PS: to get the german Date switch your language environment to german oder "de_de". Having no HP-Ux-machine at hand i can point you only in the general direction, you should find this somewhere in the sam-menus in the user configuration. bakunin |
|
#13
|
|||
|
|||
|
@r2007
I've tried this but when i execute it he say --time-style="long-iso" not found an the second example, too. @bakunin thank you for your opinion. I try your solution and if it works i apply it on code. |
|||
| Google The UNIX and Linux Forums |