Sponsored Content
Full Discussion: awk to grep log
Top Forums Shell Programming and Scripting awk to grep log Post 302927562 by justbow on Thursday 4th of December 2014 03:23:33 AM
Old 12-04-2014
awk to grep log

hi expert,

i Have log like :

Code:
dn: EPC-Per=673,HYHGU
objectClass: EPC-PerSubs
ownerId: 0
groupId: 4001
shareTree: nodeName=HYHGU
permissions: 15
EPC-Per: 673

dn: EPC-SessionId=54454C2D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430343834313237333B323638343336363430,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 54454C2D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430343834313237333B323638343336363430

dn: EPC-SessionId=4453542D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430353936323432333B323638343336373530,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 4453542D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430353936323432333B323638343336373530

dn: EPC-SessionId=54454C2D5341534E2D332D302E736170632E64737467726F75702E636F6D3B313431373635393130323B333031373437343436,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 54454C2D5341534E2D332D302E736170632E64737467726F75702E636F6D3B313431373635393130323B333031373437343436
EPC-IpAddress: 10.186.22.49
EPC-CalledStationId: internet
EPC-LastActivityTimeStamp: 04-12-2014T16:01:44

dn: EPC-SessionId=54454C2D5341534E2D302D302E736170632E64737467726F75702E636F6D3B313431373634333338393B393436343937313332,EPC-Per=673,HYHGU
shareTree: nodeName=HYHGU
permissions: 15
EPC-SessionId: 54454C2D5341534E2D302D302E736170632E64737467726F75702E636F6D3B313431373634333338393B393436343937313332
EPC-IpAddress: 10.186.173.102
EPC-CalledStationId: internet
EPC-LastActivityTimeStamp: 04-12-2014T13:04:51

i want to print dn session if dont have EPC-IpAdress

so output will be like this :

Code:
EPC-SessionId=54454C2D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430343834313237333B323638343336363430,EPC-Per=673,HYHGU
EPC-SessionId=4453542D5341534E2D342D302E736170632E64737467726F75702E636F6D3B313430353936323432333B323638343336373530,EPC-Per=673,HYHGU

Thanks
Justbow
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Constantly updating log files (tail -f? grep? awk?)

I have a log file which is continuously added to, called log.file. I'd like to monitor this file, and when certain lines are found, update some totals in another file. I've played around with tail -f, grep, and awk, but can't seem to hit the right note, so to speak. The lines I'm... (0 Replies)
Discussion started by: nortonloaf
0 Replies

2. UNIX for Advanced & Expert Users

WEB Server Log File Analysis using awk/sed/grep

I'm trying to find a way to show large page sizes (page size in K) from multiple web server log files. Essentially I want to show only rows from a file where a specific column is larger than some value. Has anyone ever done this type of log analysis? If so, a snippet of code would be very... (2 Replies)
Discussion started by: mike_cataldo@ad
2 Replies

3. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

4. Shell Programming and Scripting

Read content between xml tags with awk, grep, awk or what ever...

Hello, I trying to extract text that is surrounded by xml-tags. I tried this cat tst.xml | egrep "<SERVER>.*</SERVER>" |sed -e "s/<SERVER>\(.*\)<\/SERVER>/\1/"|tr "|" " " which works perfect, if the start-tag and the end-tag are in the same line, e.g.: <tag1>Hello Linux-Users</tag1> ... (5 Replies)
Discussion started by: Sebi0815
5 Replies

5. Shell Programming and Scripting

Parsing out access.log with awk and grep

In part of my script I use awk to pull out the urls. awk '{print $8}' then I take them and send them to grep.` Some of them are straight .com/ or .org or whatever (address bar entries), while others are locations of images, js, etc. I'm trying to only pull any line that ends with .com/... (11 Replies)
Discussion started by: druisgod
11 Replies

6. Shell Programming and Scripting

Use grep sed or awk to extract string from log file and put into CSV

I'd like to copy strings from a log file and put them into a CSV. The strings could be on different line numbers, depending on size of log. Example Log File: File = foo.bat Date = 11/11/11 User = Foo Bar Size = 1024 ... CSV should look like: "foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Discussion started by: chipperuga
7 Replies

7. Shell Programming and Scripting

Router ping log extract data from it Awk/Sed/grep

Hi, I am new to this world.. Using expect i loging to router and checking ping response to my links. I need to genarate report using this output and that report contains only three file link name, packet loss, latency. my output of script is like below: -bash-3.00$ monmw/mwbkp... (2 Replies)
Discussion started by: jkmistry
2 Replies

8. Shell Programming and Scripting

AWK/GREP: grep only lines starting with integer

I have an input file 12.4 1.72849432773174e+01 -7.74784188610632e+01 12.5 9.59432114416327e-01 -7.87018212757537e+01 15.6 5.20139995965960e-01 -5.61612429666624e+01 29.3 3.76696387248366e+00 -7.42896194101892e+01 32.1 1.86899877018077e+01 -7.56508762501408e+01 35 6.98857157014640e+00... (2 Replies)
Discussion started by: chrisjorg
2 Replies

9. UNIX for Dummies Questions & Answers

Piping grep into awk, read the next line using grep

Hi, I have a number of files containing the information below. """"" Fundallinfo 6.3950 14.9715 14.0482 """"" I would like to grep for Fundallinfo and use it to read the next line? I ideally would like to read the three numbers that follow in the next line and... (2 Replies)
Discussion started by: Paul Moghadam
2 Replies

10. Shell Programming and Scripting

sed / awk / grep to extract information from log

Hi all, I have a query that runs that outputs data in the following format - 01/09/12 11:43:40,ADMIN,4,77,Application Group Load: Name(TESTED) LoadId(5137-1-0-1XX-15343-15343) File(/dir/dir/File.T03.CI2.RYR.2012009.11433350806.ARD) InputSize(5344) OutputSize(1359) Rows(2) Time(1.9960)... (8 Replies)
Discussion started by: jeffs42885
8 Replies
EMPTY-PAGE(1)							 ExactImage Manual						     EMPTY-PAGE(1)

NAME
empty-page - empty page detector of the ExactImage toolkit SYNOPSIS
empty-page [option...] {-i | --input} input-file empty-page {-h | --help} DESCRIPTION
ExactImage is a fast C++ image processing library. Unlike many other library frameworks it allows operation in several color spaces and bit depths natively, resulting in low memory and computational requirements. empty-page counts dark pixels of a black and white image and decides with a threshold whether the page is most probably empty, and thus can be removed from the image processing stream. OPTIONS
-i file, --input file Read image from the specified file. -m n, --margin n Set width of border margin to skip. For speed reasons, the margin has to be a multiple of 8. The default is 16. -p x, --percentage x Set fraction of permissible dark pixels. The default is 0.05 (5%). -h, --help Display help text and exit. EXAMPLES
$ empty-page -i test.tif The image has 75461 dark pixels from a total of 1060992 (7.11231%). non-empty EXIT STATUS
The exit status is 0 if the image is mostly white, 1 otherwise. SEE ALSO
exactimage(7) AUTHORS
Jakub Wilk <jwilk@debian.org> Wrote this manual page for the Debian system. http://www.exactcode.de/site/open_source/exactimage/ This manual page incorporates texts found on the ExactImage homepage. COPYRIGHT
This manual page was written for the Debian system (and may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or (at your option) any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2. empty-page 09/09/2013 EMPTY-PAGE(1)
All times are GMT -4. The time now is 09:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy