On 2007-11-22 10:10, ann kok <[EMAIL PROTECTED]> wrote: > Hi Giorgos > > Thank you > > But my output is from your suggstion > printf "Created: %s\n", system("date +%Y%m%d"); > > 20071122 > Created: 0 > 20071122 > Updated: 0 > > how can I have output as > > Created: 20071122 > Updated: 20071122
You'll have to use the gsub() to strip newlines from the output of "date"... > In additon, > > ls it possible to have loop output also? > > I need to have > > print "File No:", CMA001 > > the second record is CMA002 and then CMA003 for the > 3rd record Sure. One way to do this is to print a formatted version of the special "NR" variable of awk (NR == number of records read so far): $ ( echo foo ; echo bar ) | awk '{ printf "%03d %s\n", NR, $0; }' 001 foo 002 bar $ If you are going to do any amount of *serious* awk programming, I recommend the following book: Dale Dougherty, Arnold Robbins. "Sed & Awk". O'Reilly & Associates. 2nd edition (March 1997) http://www.oreilly.com/catalog/sed2/ _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"