The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
grep unix.com with google



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-29-2009
Registered User
 

Join Date: Nov 2009
Location: Bolton, Manchester
Posts: 11
Question Problems with AWK

Hi I am writing a shell script for a number of things and aone problem that keeps comming up is AWK formatting.

When commands are typed into the command line they are fine, but when executed in the script the results are pilled up and not in a list/table format.

I have tried using awk'/$input/{print $1,$2,$...etc....
But it doesn't work, nothing happens, the code may aswell be invisible.

anyway here is the code I have written.


Code:
echo "Type in user: "
read input
echo "The last login of $input was: " `last $input | tail -10 | NEED CODE HERE FOR FORMATTING`

the result that comes out atm is:

Code:
The last login of jsk1gcc was:  jsk1gcc pts/17 192.168.***.** Tue Nov 17 09:35 - 12:13 (02:37) jsk1gcc pts/12 192.168.***.** Tue Nov 10 10:28 - 10:30 (00:02) jsk1gcc pts/14 192.168.***.**

how to I get it to do list like this this instead:

Code:
The last login of jsk1gcc was:  
jsk1gcc pts/17 192.168.***.** Tue Nov 17 09:35 - 12:13 (02:37) 
jsk1gcc pts/12 192.168.***.** Tue Nov 10 10:28 - 10:30 (00:02) 
jsk1gcc pts/14 192.168.***.** Tue Nov 10 10:22 - 12:14 (01:51)

Jade.
  #2 (permalink)  
Old 11-29-2009
Moderator
 

Join Date: Feb 2007
Location: The Netherlands
Posts: 4,670
Quote the output of the command:

Code:
echo "The last login of $input was: " "`last $input | tail -10 | NEED CODE HERE FOR FORMATTING`"

or just:


Code:
echo "The last login of $input was: "
last $input | tail -10

  #3 (permalink)  
Old 11-29-2009
Registered User
 

Join Date: Nov 2009
Location: Bolton, Manchester
Posts: 11
Talking omg thankyou =}

I can't believe it was that simple. Thankyou
When you've been working on one problem for more that 8 hours you forget the the simple things.

again thankyou. Feel like a dunce now =}

Jade.
Sponsored Links
Reply

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 Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problems with NTP veccinho SCO 1 01-16-2008 05:19 PM
DNS problems. Westy564 UNIX for Dummies Questions & Answers 5 02-17-2004 12:07 AM
CD-ROM Problems saucierm UNIX for Dummies Questions & Answers 5 10-23-2003 03:20 PM
'make' problems (compliation problems?) xyyz UNIX for Advanced & Expert Users 5 11-05-2001 10:47 PM



All times are GMT -4. The time now is 02:16 PM.


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