LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2006, 11:17 PM   #1
raj_deep2k1
LQ Newbie
 
Registered: Jan 2006
Posts: 25

Rep: Reputation: 15
Unhappy Redirection through AWK


Hi All,
I am facing a problem in redirecting the output of a shell script.
File is as below
----------------------------------------------------
#manage.sh
clear
tail -F /var/log/squid/access.log | awk '{print $3 "\t" $7 >>
output.txt }'
-------------------------------------------

so it not working,no texts going to output.txt,why?
I want to store output of the access.log into output.txt...
Please help

-Rajendra
 
Old 01-21-2006, 12:22 AM   #2
card-suse
Member
 
Registered: Dec 2005
Location: Ohio, USA
Distribution: OpenSuSE 10.2
Posts: 74

Rep: Reputation: 15
I think your redirect to output.txt is in the wrong place. Try:

tail -F /var/log/squid/access.log | awk '{print $3 "\t" $7}' >> output.txt
 
Old 01-21-2006, 01:26 AM   #3
raj_deep2k1
LQ Newbie
 
Registered: Jan 2006
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by card-suse
I think your redirect to output.txt is in the wrong place. Try:

tail -F /var/log/squid/access.log | awk '{print $3 "\t" $7}' >> output.txt

Thanks a lot ,it is working sometimes and sometimes not...why?

-Rajendra Shakyawal

Last edited by raj_deep2k1; 01-21-2006 at 01:39 AM.
 
Old 01-21-2006, 08:11 AM   #4
card-suse
Member
 
Registered: Dec 2005
Location: Ohio, USA
Distribution: OpenSuSE 10.2
Posts: 74

Rep: Reputation: 15
When you say it's not working I'm assuming that you sometimes don't have output appended to output.txt. For now, the only reason I can think of is simply that awk is not finding a column 3 or 7 in the last 10 lines of access.log. You probably know that tail will only output the last 10 lines by default unless you use the -n flag and specify more. Could this be the case?
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wget and redirection EmOuBi Linux - Software 6 01-09-2013 05:53 AM
X Client Redirection LostAgain Linux - General 4 11-27-2004 08:31 PM
stderr redirection evilop Linux - Newbie 3 09-21-2004 04:27 PM
redirection in C pantera Programming 2 08-11-2004 01:06 PM
Spamassassin redirection dominant Linux - Networking 0 01-16-2004 01:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration