<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>james young &#187; sed</title>
	<atom:link href="http://psyjinx.com/jyoung/tag/sed/feed/" rel="self" type="application/rss+xml" />
	<link>http://psyjinx.com/jyoung</link>
	<description>web application developer</description>
	<lastBuildDate>Sun, 15 Aug 2010 14:31:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>command line reporting</title>
		<link>http://psyjinx.com/jyoung/2007/04/command-line-reporting/</link>
		<comments>http://psyjinx.com/jyoung/2007/04/command-line-reporting/#comments</comments>
		<pubDate>Sun, 29 Apr 2007 04:52:53 +0000</pubDate>
		<dc:creator>James Young</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://psyjinx.com/wp/?p=43</guid>
		<description><![CDATA[<p>Here are some things I have done in the past to pull data out of log files.  I find myself referring to this list from time to time to remember how I did things in the past.</p>

Real Queries That May Need To Be Repeated
&#160;
ATT YIH upgrades in the month of 200709
$ listysftclog 200709* &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some things I have done in the past to pull data out of log files.  I find myself referring to this list from time to time to remember how I did things in the past.</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">Real Queries That May Need To Be Repeated
&nbsp;
ATT YIH upgrades <span style="color: #804040;">in</span> the month of <span style="color: #000000; font-weight:bold;">200709</span>
<span style="color: #000000;">$</span> listysftclog <span style="color: #000000; font-weight:bold;">200709</span><span style="color: #000000;">*</span> <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/(yihupg[^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>r <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c
&nbsp;
Scratch Work
These searches are mostly captures <span style="color: #804040;">in</span> cronjobs and shell scripts<span style="color: #000000;">.</span> Using this page as a place to store some of them <span style="color: #804040;">while</span> working them out<span style="color: #000000;">.</span>
&nbsp;
Misc Searches
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/beacon.choice~([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> sed <span style="color: #C5A22D;">'s/&amp;/<span style="">\&amp;</span>/'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>nr
&nbsp;
Get page views <span style="color: #804040;">for</span> att<span style="color: #000000;">/</span>v4 choice page
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> grep choice<span style="color: #000000;">.</span>php <span style="color: #000000;">|</span> grep result<span style="color: #000000;">~</span><span style="color: #000000; font-weight:bold;">200</span> <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Get uniq visits to choice page
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> grep result<span style="color: #000000;">~</span><span style="color: #000000; font-weight:bold;">200</span> <span style="color: #000000;">|</span> cut <span style="color: #000000;">-</span>f10 <span style="color: #000000;">-</span>d\<span style="color: #000000;">|</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Get all user agents
This still needs some work, there is a <span style="color: #000000;">^</span>D <span style="color: #804040;">in</span> there that needs to be removed
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">/</span>home<span style="color: #000000;">/</span>y<span style="color: #000000;">/</span>logs<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/choiceua([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>nr
&nbsp;
Get Windows users
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">/</span>home<span style="color: #000000;">/</span>y<span style="color: #000000;">/</span>logs<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/choiceua([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> grep Windows <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Get Mac users
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">/</span>home<span style="color: #000000;">/</span>y<span style="color: #000000;">/</span>logs<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/choiceua([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> grep Mac <span style="color: #000000;">|</span> wc <span style="color: #000000;">-</span>l
&nbsp;
Specific examples
   <span style="color: #000000;">*</span> Replace <span style="color: #000000;">&amp;</span> <span style="color: #804040;">in</span> <span style="color: #25BB4D;">search</span> results with <span style="color: #000000;">&amp;</span>
<span style="color: #000000;">$</span> <span style="color: #804040;">cat</span> <span style="color: #000000;">~/</span>ysftc<span style="color: #000000;">.</span>log <span style="color: #000000;">|</span> grep att<span style="color: #000000;">/</span>v4 <span style="color: #000000;">|</span> perl <span style="color: #000000;">-</span>ne <span style="color: #C5A22D;">'if(/beacon.choice~([^|]*)/){print $1.&quot;<span style="">\n</span>&quot;;}'</span> <span style="color: #000000;">|</span> sed <span style="color: #C5A22D;">'s/&amp;/<span style="">\&amp;</span>/'</span> <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">|</span> uniq <span style="color: #000000;">-</span>c <span style="color: #000000;">|</span> <span style="color: #25BB4D;">sort</span> <span style="color: #000000;">-</span>nr
 <span style="color: #000000; font-weight:bold;">23</span> AT<span style="color: #000000;">&amp;</span>T Yahoo<span style="color: #000000;">!</span> Online Protection
 <span style="color: #000000; font-weight:bold;">13</span> Parental Controls
 <span style="color: #000000; font-weight:bold;">11</span> AT<span style="color: #000000;">&amp;</span>T Yahoo<span style="color: #000000;">!</span> Messenger
 <span style="color: #000000; font-weight:bold;">11</span> AT<span style="color: #000000;">&amp;</span>T Yahoo<span style="color: #000000;">!</span> Browser
 <span style="color: #000000; font-weight:bold;">11</span> AT<span style="color: #000000;">&amp;</span>T Toolbar
  <span style="color: #000000; font-weight:bold;">6</span> Connection Manager
  <span style="color: #000000; font-weight:bold;">2</span> AT<span style="color: #000000;">&amp;</span>T Pop<span style="color: #000000;">-</span>Up Blocker
  <span style="color: #000000; font-weight:bold;">1</span> AT<span style="color: #000000;">&amp;</span>T Security Suite SM</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://psyjinx.com/jyoung/2007/04/command-line-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
