The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
.
google unix.com



UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
print all dates 100 days from current date pavan_test UNIX for Dummies Questions & Answers 5 07-20-2009 10:25 PM
awk to print current date? philipz UNIX for Dummies Questions & Answers 3 09-02-2008 04:58 PM
how to print date using ftp commands kittusri9 Shell Programming and Scripting 3 05-07-2008 04:48 AM
how to print the date and time separately??? jisha Shell Programming and Scripting 8 01-16-2008 06:23 AM
Need to print file names in a certain date range using ls Shamwari UNIX for Dummies Questions & Answers 2 10-08-2001 08:14 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5 (permalink)  
Old 4 Weeks Ago
fmeriles fmeriles is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 3
Quote:
Originally Posted by radoulov View Post
You can use something like this:


Code:
awk <<< 1  'BEGIN {
  printf "start: "; system("date")
  }
system("sleep 3")
END {
  printf "end: "; system("date") 
  }'



Code:
zsh-4.3.10[sysadmin]% awk <<< 1  'BEGIN {
  printf "start: "; system("date")
  }
system("sleep 3")
END {
  printf "end: "; system("date")
  }'  
start: Fri Nov  6 15:38:53     2009
end: Fri Nov  6 15:38:56     2009

---------- Post updated at 03:47 PM ---------- Previous update was at 03:31 PM ----------

Actually, you just need to close the external command:


Code:
awk <<< 1  'BEGIN {
  "date" | getline dt
  close("date")
  print "start:", dt
  }
system("sleep 3")
END {
  "date" | getline dt
  close("date")
  print "end:", dt 
  }'


Like this:


Code:
zsh-4.3.10[sysadmin]% awk <<< 1  'BEGIN {
  "date" | getline dt
  close("date")
  print "start:", dt
  }
system("sleep 3")
END {
  "date" | getline dt
  close("date")
  print "end:", dt
  }' 
start: Fri Nov  6 15:47:23     2009
end: Fri Nov  6 15:47:27     2009

It works! Thank you very much dude!
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0