Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

awk for tcl?

237 views
Skip to first unread message

Naeem Afzal

unread,
Mar 20, 1997, 3:00:00 AM3/20/97
to

Is there any way you can convert unix command with awk command in it to
tcl
command. I want to use the following command in my tcl script.
>
> set d = `date '+DATE:%m.%d.%y' | awk -F: ' { print $2 }'`
>
> I would appreciate any suggestion on how to do it.
>
>
>
>
> naeem...@Corp.Sun.COM
> Ph. 415.336.9831 FAX 415.960-0943

Michael Schumacher

unread,
Mar 20, 1997, 3:00:00 AM3/20/97
to

Naeem Afzal <naeem...@corp.sun.com> wrote:
: Is there any way you can convert unix command with awk command in it to

: tcl command. I want to use the following command in my tcl script.
: >
: > set d = `date '+DATE:%m.%d.%y' | awk -F: ' { print $2 }'`

You will for sure read the man page of Tcl's "clock" command. ;-)


mike

Ken Edwards

unread,
Mar 20, 1997, 3:00:00 AM3/20/97
to

Naeem Afzal <naeem...@corp.sun.com> writes:

>Is there any way you can convert unix command with awk command in it to
>tcl
> command. I want to use the following command in my tcl script.
> >
> > set d = `date '+DATE:%m.%d.%y' | awk -F: ' { print $2 }'`
> >

> > I would appreciate any suggestion on how to do it.

set d [clock format [clock seconds] -format %m.%d.%y]


Donal K. Fellows

unread,
Mar 25, 1997, 3:00:00 AM3/25/97
to

In article <333166...@corp.sun.com>,

Naeem Afzal <naeem...@corp.sun.com> wrote:
> Is there any way you can convert unix command with awk command in it to
> tcl command. I want to use the following command in my tcl script.
> set d = `date '+DATE:%m.%d.%y' | awk -F: ' { print $2 }'`

set d [exec date +DATE:%m.%d.%y | awk -F: {{print $2}}]

Note the lack of single quote characters, and the double curlies round
the `print $2'. Do not use this script as-is in a binding (but a proc
called by a binding is OK, and easier in the long run anyway)

Donal.
--
Donal K. Fellows http://r8h.cs.man.ac.uk:8000/ (SAY NO TO COMMERCIAL SPAMS!)
(work) fell...@cs.man.ac.uk Dept. Comp. Sci, Univ. Manchester, U.K.
| do...@ugglan.demon.co.uk 6,Randall Place, Heaton, Bradford, U.K. (home)
+-> ++44-161-275-6137 Send correspondence to my office ++44-1274-401017 <-+

0 new messages