The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To store the output in a variable Sudhakar333 Shell Programming and Scripting 2 07-10-2007 09:45 AM
Read and store each line of a file to a variable seijihiko UNIX for Dummies Questions & Answers 4 06-17-2007 06:57 AM
read file and output message happyv Shell Programming and Scripting 12 01-24-2007 09:57 PM
Store output and Echo meyerder Shell Programming and Scripting 2 05-14-2006 10:44 AM
how to read each letter from file and store it in variable. rajan_ka1 UNIX for Advanced & Expert Users 7 03-06-2006 09:03 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-04-2005
afadaghi afadaghi is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 10
Unhappy store output to a file and read from it

Hello all,
I need to run snoop command for a period of time (a day) and extract remote host column from it to find out who is accessing my server. When I run the following on the command line it works
snoop -port 22 | awk '{print $3}'
but when I do
snoop -port 22 | awk '{print $3}' | while read hname;do echo $hname;done
it does not work. I need to caputre the outbound hostnames and do some testing on them. Any idea would be much appreciated
  #2 (permalink)  
Old 10-04-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
Code:

for hname in `snoop -port 22 | awk '{print $3}' `
do
     echo $hname
done > outputfile
  #3 (permalink)  
Old 10-04-2005
afadaghi afadaghi is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 10
Jim thanks for the input but, it is not working. I do not get anything in the output file
Closed Thread

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 On




All times are GMT -4. The time now is 01:50 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