awk Question 
Author Message
 awk Question

I was trying to figure out how to call a program
from awk, in this case the date command, and have
the output show up in my document. For example:

text
text
text
text
report created on date.....

Thanks
Karl

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Fri, 24 Jan 2003 03:00:00 GMT  
 awk Question
% I was trying to figure out how to call a program
% from awk, in this case the date command, and have
% the output show up in my document. For example:

Use getline:

 cmd = "date +%Y/%m/%d"
 cmd | getline
 close(cmd)

The close() is important if you want to run the command again later. The
argument to close must be exactly the same as the command piped to getline.
--

Patrick TJ McPhee
East York  Canada



Fri, 24 Jan 2003 03:00:00 GMT  
 awk Question

Quote:


> % I was trying to figure out how to call a program
> % from awk, in this case the date command, and have
> % the output show up in my document. For example:

> Use getline:
>  cmd = "date +%Y/%m/%d"
>  cmd | getline
>  close(cmd)

> The close() is important if you want to run the command again later. The
> argument to close must be exactly the same as the command piped to getline.

No need to reinvent the wheel: at least in gawk you've got
available strftime([format [, timestamp]]), with similar
behaviour as the function in ANSI C.

--
  All true believers shall break their eggs at the convenient end.

.
.
.
.
.
.
.
.
.
.
.



Fri, 24 Jan 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Simple awk question

2. A Newbie AWK question

3. awk question

4. awk question about matching a pattern

5. AWK question

6. newbie awk question

7. awk questions !!!

8. Simple awk question

9. Easy Awk Question

10. Awk question.

11. awk question

12. awk question

 

 
Powered by phpBB® Forum Software