date and time to display on the terminal


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting date and time to display on the terminal
# 8  
Old 09-05-2007
Code:
awk '{ gsub(/\[|\]/,"");print $1,$2,$(NF-1),$NF }' "file"

# 9  
Old 09-05-2007
sorry dude this just isnt working for me, heres my script :

#!/bin/ksh
set -A CLUSTER 1 2 3

i=0;
while [ i -lt 3 ];
do
cd /log/logdir${CLUSTER[$i]}

grep -i 'RESPONSE' Out.log > /tmp/tmpfile.log

cd /tmp/

/usr/bin/awk '{ gsub(/\[|\]/,"");print $1,$2,$(NF-1),$NF }'"tmpfile.log"

(( i=i+1 )) ;

done;


output i get is :


awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 1
awk: bailing out near line 1
# 10  
Old 09-05-2007
Quote:
Originally Posted by cesarNZ
/usr/bin/awk '{ gsub(/\[|\]/,"");print $1,$2,$(NF-1),$NF }'"tmpfile.log"
dude, leave a space between the awk parameters and the file name.
# 11  
Old 09-05-2007
sorry that was a typo Smilie was trying to rush it, the line is actually as follows :


/usr/bin/awk '{ gsub(/\[|\]/,"");print $1,$2,$(NF-1),$NF }' "tmpfile.log"

and i still get the same error, any more suggestions ?
# 12  
Old 09-05-2007
hi,
actually i got around the problem by using a while read LINE; loop. thanks for all your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display-performance in terminal, bash or python?

Heyas I've been working on my project TUI (Text User Interface) for quite some time now, its a hobby project, so nothing i sit in front of 8hrs/day. Since the only 'real' programming language i knw is Visual Basic, based upon early steps with MS-Batch files. When i 'joined' linux 3 years ago,... (7 Replies)
Discussion started by: sea
7 Replies

2. UNIX for Dummies Questions & Answers

Display Date and Time in GDB

In gdb is there any way we can display date/time in first column while debugging or is there any command which will print date/time? I am asking this just to know when exactly a breakpoint got hit. (6 Replies)
Discussion started by: rupeshkp728
6 Replies

3. Shell Programming and Scripting

Display files created on particular date & time

Hi , I have BASH system & i am trying to display the files created on a particular date and time, and after displaying those files I also want to delete all those files.Can anyone of you help me out for this............. Thanx Original post contents restored... Please do not erase the question... (3 Replies)
Discussion started by: rakeshtomar82
3 Replies

4. Shell Programming and Scripting

How to display message when starting a terminal

Hello all, I would like a message to be displayed on the shell when someone opens up the terminal - something like a welcome msg with date and time. I know how to do this by running the shell commands but dont know how to display it when a user opens up the terminal? Thanks in advance (27 Replies)
Discussion started by: mrudula009
27 Replies

5. UNIX for Dummies Questions & Answers

How to always display date/time regardless of directory?

I found via Google a way to show the date and time stamp once I log in. However, whenever I cd to another directory it doesn't display the correct path. Here are the relevant parts from my .kshrc : unset _h _m _s eval $(date "+_h=%H ;_m=%M ;_s=%S") ((SECONDS =... (3 Replies)
Discussion started by: Mike F.
3 Replies

6. AIX

Unable to display the date-time in seconds on AIX

Hi, In unix the command "date +%s" displays the date-time in seconds since â00:00:00 1970-01-01 UTCâ (a GNU extension) when executed on unix: -sh-2.05b$ date +%s 1152092690 I tried with all the format control output but unable to display the date-time in seconds i,e as in unix format. Can... (6 Replies)
Discussion started by: me_haroon
6 Replies

7. Solaris

display date n Time

Hi Friends, Can any one guide me regarding 'Display the date and time' command other than the command 'date' thanks n regards SsRrIi (1 Reply)
Discussion started by: SsRrIi
1 Replies

8. UNIX for Advanced & Expert Users

Understanding terminal display of (awkward) characters

Gurus, I've been on computers for a while, but I've yet to have the behind-the-scenes knowledge. I'm not sure if this is so much a Unix question as it is a nitty gritty computer one. We received a customer file which had a "funny apostrophe." When displaying the file via more, the character... (1 Reply)
Discussion started by: effigy
1 Replies

9. UNIX for Dummies Questions & Answers

terminal display

I want to display a system warning message at the prompt of every live terminal on a sun solaris 8 machine using CDE. I know this can be done on a console, but what about dtterm and xterm regular windows? Does anyone know how this is done? What about a single terminal? Clear skies,... (2 Replies)
Discussion started by: seismic_willy
2 Replies

10. UNIX for Dummies Questions & Answers

Script to display last login date/time?

I was wondering if anyone had a script that would display the last time a user logged into a particular machine. I know about the "last" command, but it gives too much info.... I just wanted to know the last time a user used his/her id. ANy help would be greatly appreciated. Ryan (3 Replies)
Discussion started by: ryaneverett5
3 Replies
Login or Register to Ask a Question