Last Modified Date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Last Modified Date
# 1  
Old 06-24-2005
Last Modified Date

Hello,

I'm on a practical training and i have to change a shell script which print out a HTML-File with all Printers (and features example: IP, Mac etc.) they have in the factory.
The Features of the Printers are on each separate file. i mean every printer have an own file with it features.

Well, I have to change it that the script prints me the last Modified Date of the File,too.

i have found the command flastmod but i'm a newbie in shell Programming

here is a litte part of the script (i think it's the print out)

Code:
 
   grep Kostenstelle     $PFAD$DR | awk '{printf("<TD>%s\n",$2)}' | tee -a $HTMLFILE
    grep Bemerkung        $PFAD$DR | awk '{printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'   | tee -a $HTMLFILE
    grep Fertigungspunkt  $PFAD$DR | awk '{printf("<TD>%s\n",$2)}'   | tee -a $HTMLFILE
    grep Gebaeude         $PFAD$DR | awk '{printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'   | tee -a $HTMLFILE
    grep Sauele           $PFAD$DR | awk '{printf("<TD>%s\n",$2)}'   | tee -a $HTMLFILE
    grep Telefon          $PFAD$DR | awk '{printf("<TD>%s\n",$2)}'   | tee -a $HTMLFILE
    grep Kabel-Nr         $PFAD$DR | awk '{printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'   | tee -a $HTMLFILE
    grep IP-Adresse       $PFAD$DR | awk '{printf("<TD>%s\n",$2)}' | tee -a $HTMLFILE
    grep MAC-Adresse      $PFAD$DR | awk '{printf("<TD><FONT SIZE=-1>%s</FONT>\n",$2)}'   | tee -a $HTMLFILE

thx
# 2  
Old 06-24-2005
Code:
awk '/Kostenstelle/{printf("<TD>%s\n",$2)}' $PFAD$DR | tee -a $HTMLFILE
...
...
...
awk '/MAC-Adresse/{printf("<TD><FONT SIZE=-1>%s</FONT>\n",$2)}' $PFAD$DR | tee -a $HTMLFILE
#add time of last modification here
stat -c "%y" $PFAD$DR | tee -a $HTMLFILE

# 3  
Old 06-24-2005
thanks

it's not working, well it is working but the date of last modified ist not working.

It print's it out if it is a string

Code:
awk '/Kostenstelle/ {printf("<TD>%s\n",$2)}'$PFAD$DR                             | tee -a $HTMLFILE
    awk '/Bemerkung/   {printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}' $PFAD$DR     | tee -a $HTMLFILE
    awk '/Fertigungspunkt/{printf("<TD>%s\n",$2)}'  $PFAD$DR                         | tee -a $HTMLFILE
    awk '/Gebaeude/       {printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'  $PFAD$DR | tee -a $HTMLFILE
    awk '/Sauele/       {printf("<TD>%s\n",$2)}' $PFAD$DR                            | tee -a $HTMLFILE
    awk '/Telefon/ {printf("<TD>%s\n",$2)}' $PFAD$DR                                 | tee -a $HTMLFILE
    awk '/Kabel-Nr/      {printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'  $PFAD$DR  | tee -a $HTMLFILE
    awk '/IP-Adresse/      {printf("<TD>%s\n",$2)}' $PFAD$DR                         | tee -a $HTMLFILE
    echo 'stat -c "%y" $PFAD$DR '                                                    | tee -a $HTMLFILE

# 4  
Old 06-24-2005
well, miss the <TD> tag.
Code:
stat -c "%y" $PFAD$DR | awk '{printf("<TD>%s\n",$0)}' | tee -a $HTMLFILE

# 5  
Old 06-27-2005
it doesnt work

Code:
    grep Kostenstelle     $PFAD$DR | awk '{printf("<TD>%s\n",$2)}' | tee -a $HTMLFILE
    grep Bemerkung        $PFAD$DR | awk '{printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'   | tee -a $HTMLFILE
    grep Fertigungspunkt  $PFAD$DR | awk '{printf("<TD>%s\n",$2)}'   | tee -a $HTMLFILE
    grep Gebaeude         $PFAD$DR | awk '{printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'   | tee -a $HTMLFILE
    grep Sauele           $PFAD$DR | awk '{printf("<TD>%s\n",$2)}'   | tee -a $HTMLFILE
    grep Telefon          $PFAD$DR | awk '{printf("<TD>%s\n",$2)}'   | tee -a $HTMLFILE
    grep Kabel-Nr         $PFAD$DR | awk '{printf("<TD>%s %s %s %s %s\n",$2,$3,$4,$5,$6)}'   | tee -a $HTMLFILE
    grep IP-Adresse       $PFAD$DR | awk '{printf("<TD>%s\n",$2)}' | tee -a $HTMLFILE
    stat -c "%y" $PFAD$DR | awk '{printf("<TD>%s\n",$0)}' | tee -a $HTMLFILE

# 6  
Old 06-27-2005
as a programer, you should show more details, please post the output or error messages. Smilie
# 7  
Old 06-27-2005
yeah that's the problem

i have no error message it print's me the table with the data out.

here is a screeshot
http://img156.echo.cx/my.php?image=screen4cf.jpg
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

How do I display a file's last modified date?

I'm using a script that I need to get a file's "last modified date" in a format like 01:51:14 PM. We are running on AIX 6.1.0.0. I can't seem to find the right command parameters. Help! (4 Replies)
Discussion started by: mattadams1983
4 Replies

2. Shell Programming and Scripting

Script to copy creation date over top of modified date?

Can someone draw up a script that for every file, folder and subfolder and files that will copy the creation date over top of the modified date?? I know how to touch every file recursively, but no idea how to read a files creation date then use that to touch the modification date of that file,... (3 Replies)
Discussion started by: toysareforboys
3 Replies

3. UNIX for Dummies Questions & Answers

Du command and modified date in ssh

Hello, I am a new user to linux and having trouble completing this task. I want to list a directory of files and folders including the name, human readable size, and last modified date. So far I can get two of the three but not all together. For example: Using ls -lh gives me drwxr-xr-x... (7 Replies)
Discussion started by: Newuzer
7 Replies

4. Shell Programming and Scripting

current date modified file

Hi , In my directory , i have many days file but i want to see all those which are of todays date. i tried this but it gives all the files mtime -0 |ls -ltr I tried the below option as well. 19635 find -iname "*.LOG" -mtime 19636 ls -ltr *.LOG -mtime -1 19637 ls -ltr *.LOG... (7 Replies)
Discussion started by: guddu_12
7 Replies

5. Shell Programming and Scripting

How to get the files which has modified date as yesterday and before?

Hi All, Can you please help me to get only the files which has the modified date as yesterday and before? Thanks in advance! Regards, Velava.S (4 Replies)
Discussion started by: velava
4 Replies

6. UNIX for Dummies Questions & Answers

Find last modified date for many files

Hello all - I've looked and have not been able to find a "find" command that will list the last modified date of files within a specific directory and its subdirectories. If anyone knows of such a command it would be very much appreciated! If possible, I would like to sort this output and have... (5 Replies)
Discussion started by: MichaelH3947
5 Replies

7. Shell Programming and Scripting

search by modified date

Hello, How can i search for all the files in a particular directory which are not updated from past 5 days. Thanks, Sateesh (4 Replies)
Discussion started by: kotasateesh
4 Replies

8. UNIX for Dummies Questions & Answers

Last Modified Date for subfolders

Sorry for the basic question, but I have a feeling that my developers are circumventing our change control process, and I want to be able to easily keep track of the last modified date of sub-folders of the production folder. Basically, we have this major folder PROD, and then each application... (1 Reply)
Discussion started by: saint01
1 Replies

9. Shell Programming and Scripting

greping certain modified date

i have a k shell script that grep less than certain modified date ------------------------------------------------- #!/bin/ksh for i in * do day=`ls -ltr | grep $i | tr -s " " | cut -d " " -f6-7 | awk 'substr($0,7,4)substr($0,1,5)substr($0,11)<"Feb 1"' ` echo $day done... (2 Replies)
Discussion started by: ali560045
2 Replies

10. UNIX for Dummies Questions & Answers

How do I get the last modified date of a file?

I am trying to load a group of files and their last dates modified into a text file that will in turn be used with SQL*Loader to load these files into Oracle. I am using a *.ksh script. I am getting the name of the file in by using the following: for file_ext in 'cat loaddir.ext'; do find... (2 Replies)
Discussion started by: akpopa
2 Replies
Login or Register to Ask a Question