The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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 09:44 PM
greping certain modified date ali560045 Shell Programming and Scripting 2 02-08-2008 03:54 AM
Create a list of files that were modified after a given date. rkka UNIX for Dummies Questions & Answers 4 01-22-2008 01: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

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2005
Registered User
 

Join Date: Jun 2005
Posts: 16
Stumble this Post!
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-24-2005
r2007's Avatar
Registered User
 

Join Date: Jun 2005
Location: China
Posts: 73
Stumble this Post!
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
Reply With Quote
  #3 (permalink)  
Old 06-24-2005
Registered User
 

Join Date: Jun 2005
Posts: 16
Stumble this Post!
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
Reply With Quote
  #4 (permalink)  
Old 06-24-2005
r2007's Avatar
Registered User
 

Join Date: Jun 2005
Location: China
Posts: 73
Stumble this Post!
well, miss the <TD> tag.
Code:
stat -c "%y" $PFAD$DR | awk '{printf("<TD>%s\n",$0)}' | tee -a $HTMLFILE
Reply With Quote
  #5 (permalink)  
Old 06-27-2005
Registered User
 

Join Date: Jun 2005
Posts: 16
Stumble this Post!
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
Reply With Quote
  #6 (permalink)  
Old 06-27-2005
r2007's Avatar
Registered User
 

Join Date: Jun 2005
Location: China
Posts: 73
Stumble this Post!
as a programer, you should show more details, please post the output or error messages.
Reply With Quote
  #7 (permalink)  
Old 06-27-2005
Registered User
 

Join Date: Jun 2005
Posts: 16
Stumble this Post!
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0