Sponsored Content
Full Discussion: Grep the ip to a text file
Operating Systems Linux Grep the ip to a text file Post 302888922 by babinlonston on Tuesday 18th of February 2014 02:08:11 AM
Old 02-18-2014
Linux [Solved] Grep the ip to a text file

Hi all,

We Have Squid server, We need to get the particular IP's log from /var/log/squid/access.log, if i need to get only the log's of 192.168.0.99, How can i get the log's to a separate file.

Here is the sample log what i have got from access.log file

Code:
1392706763.690    847 192.168.0.99 TCP_MISS/204 373 GET http://b.scorecardresearch.com/b? - DIRECT/125.56.200.163 -
1392706763.840    837 192.168.0.32 TCP_MISS/200 2518 GET http://engine.adzerk.net/ados? - DIRECT/54.225.174.133 application/javascript
1392706729.262      0 192.168.0.76 TCP_IMS_HIT/304 339 GET http://html5shim.googlecode.com/svn/trunk/html5.js - NONE/- text/javascript
1392706764.016      0 192.168.0.99 TCP_IMS_HIT/304 435 GET http://cdn-careers.sstatic.net/careers/gethired/sidebar.min.css? - NONE/- text/css
1392706713.330    250 192.168.0.115 TCP_MISS/204 524 GET http://s.youtube.com/stream_204? - DIRECT/74.125.236.194 text/html

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep multiple text files in folder into 1 text file?

How do I use the grep command to take mutiple text files in a folder and make one huge text file out of them. I'm using Mac OS X and can not find a text tool that does it so I figured I'd resort to the BSD Unix CLI for a solution... there are 5,300 files that I want to write to one huge file so... (7 Replies)
Discussion started by: coppertone
7 Replies

2. UNIX for Dummies Questions & Answers

getting particular text after grep from lookup file

Hi I have two files a1 and b1 a1 has the following job names ab cd ef b1 has the following job details /*----------- ji -----------------*/ asdasd fgd saas dfdf asas fd gfg /*---------- ab ----------------*/ ara jhk dfhk asjla condition: s(abc_wf_hi) (10 Replies)
Discussion started by: napolayan
10 Replies

3. Shell Programming and Scripting

Text file with grep

Sirs, i am trying to create simple script file.. what i do is grep for a pattern and output 1 line after it. exmp: grep -A 1 time files.txt Output: time file1 time file2 --- Is there some option I can use so I can get on result each 2 lines combined as one file? like: time file1... (2 Replies)
Discussion started by: alekkz
2 Replies

4. Shell Programming and Scripting

grep a line from a text file

Hi all, I need to grep a line from a log file which ensures me that the application server script is executed successfully. Some body please help me on this. I also need to write a while loop in which i need to use the status of the above grep output. Could some one please tell me how to use... (12 Replies)
Discussion started by: firestar
12 Replies

5. Shell Programming and Scripting

grep output of a text file

Hi. I have a unix script 'if' condition that greps through a file and searches for the strings ERROR and WARNING. if egrep -q 'ERROR|WARNING' myfile.txt; then When this 'if' condition is true then I want to be able to capture 10 lines before the string and 10 lines after the string. So... (6 Replies)
Discussion started by: buechler66
6 Replies

6. Shell Programming and Scripting

search text file in file if this file contains necessary text (awk,grep)

Hello friends! Help me pls to write correct awk and grep statements for my task: I have got files with name filename.txt It has such structure: Start of file FROM: address@domen.com (12...890) abc DATE: 11/23/2009 on Std SUBJECT: any subject End of file So, I must check, if this file... (4 Replies)
Discussion started by: candyme
4 Replies

7. Shell Programming and Scripting

Grep text from file

Hi, I used the grep command and got the result below. However, I just want the following information: Build Version: DnETest Build Build Date-Time: 01/27/2012 07:56:14 AM Any suggestion from the current out put I have: <td><span class="style29"> Build Version: </span></td>... (1 Reply)
Discussion started by: xitrum
1 Replies

8. UNIX for Dummies Questions & Answers

How to grep multiple lines from a text file using another text file?

I would like to use grep to select multiple lines from a text file using a single-column text file. Basically I want to only select lines from the first text file where the second column of the first text file matches the second text file. How do I go about doing that? Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies

9. Shell Programming and Scripting

How to grep a log file for words listed in separate text file?

Hello, I want to grep a log ("server.log") for words in a separate file ("white-list.txt") and generate a separate log file containing each line that uses a word from the "white-list.txt" file. Putting that in bullet points: Search through "server.log" for lines that contain any word... (15 Replies)
Discussion started by: nbsparks
15 Replies

10. Shell Programming and Scripting

Using echo, grep and wc and outputing to text file

My current line command is as follows: echo -n "text: " ; grep "blah text" ../dir1/filename | wc -l The output to the screen is as needed, but how do I print to a text file? (9 Replies)
Discussion started by: ncwxpanther
9 Replies
nislog(1M)						  System Administration Commands						nislog(1M)

NAME
nislog - display the contents of the NIS+ transaction log SYNOPSIS
/usr/sbin/nislog [-h num | -t num] [-v] [directory...] DESCRIPTION
nislog displays the contents of the NIS+ server transaction log on the standard output. This command can be used to track changes in the namespace. The /var/nis/trans.log file contains the transaction log maintained by the NIS+ server. When updates occur, they are logged to this file and then propagated to replicas as log transactions. When the log is checkpointed, updates that have been propagated to the replicas are removed. The nislog command can only be run on an NIS+ server by superuser. It displays the log entries for that server only. If directory is not specified, the entire log is searched. Otherwise, only those logs entries that correspond to the specified directories are displayed. OPTIONS
-h num Display num transactions from the ``head'' of the log. If the numeric parameter is 0, only the log header is displayed. -t num Display num transactions from the ``tail'' of the log. If the numeric parameter is 0, only the log header is displayed. -v Verbose mode. FILES
/var/nis/trans.log transaction log ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWnisu | +-----------------------------+-----------------------------+ SEE ALSO
nis+(1), rpc.nisd(1M), nisfiles(4), attributes(5) NOTES
NIS+ might not be supported in future releases of the SolarisTM Operating Environment. Tools to aid the migration from NIS+ to LDAP are available in the Solaris 9 operating environment. For more information, visit http://www.sun.com/directory/nisplus/transition.html. SunOS 5.10 12 Dec 2001 nislog(1M)
All times are GMT -4. The time now is 10:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy