<?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>Pario TechnoBlob &#187; egrep</title>
	<atom:link href="http://pario.no/tag/egrep/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 26 Apr 2012 08:18:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Find domain expiration date</title>
		<link>http://pario.no/2007/09/08/find-domain-expiration-date/</link>
		<comments>http://pario.no/2007/09/08/find-domain-expiration-date/#comments</comments>
		<pubDate>Sat, 08 Sep 2007 00:27:13 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[egrep]]></category>
		<category><![CDATA[whois]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/09/08/find-domain-expiration-date/</guid>
		<description><![CDATA[To get expiration date use grep command: $ whois nixcraft.com &#124; egrep -i 'Expiration&#124;Expires on' Output: Expiration Date: 10-may-2009 NOTICE: The expiration date displayed in this record is the date the currently set to expire. This date does not necessarily reflect the expiration view the registrar's reported date of expiration for this registration. Expires on: [...]]]></description>
			<content:encoded><![CDATA[<p>To get expiration date use grep command:</p>
<p><code>$ whois nixcraft.com | egrep -i 'Expiration|Expires on'</code><br />
Output:</p>
<pre> Expiration Date: 10-may-2009
NOTICE: The expiration date displayed in this record is the date the
currently set to expire. This date does not necessarily reflect the expiration
view the registrar's reported date of expiration for this registration.
      Expires on: 10-May-09</pre>
<p>Here is my script:</p>
<pre>#!/bin/bash
# Domain name list - add your domainname here
DOM="theos.in cricketnow.in nixcraft.com nixcraft.org nixcraft.biz nixcraft.net nixcraft.info cyberciti.biz cyberciti.org gite.in nixcraft.in"
for d in $DOM
do
  echo -n "$d - "
  whois $d | egrep -i 'Expiration|Expires on' | head -1
  # If you need list..
  # whois $d | egrep -i 'Expiration|Expires on' | head -1 &gt;&gt; /tmp/domain.date
  #
  echo ""
done
#
# [ -f /tmp/domain.date ] &amp;&amp; mail -s 'Domain renew / expiration date' you@yahoo.com &lt; /tmp/domain.date || :
#</pre>
<p>Output:</p>
<pre>theos.in - Expiration Date:28-Oct-2007 13:01:58 UTC

cricketnow.in - Expiration Date:29-Jul-2008 09:17:56 UTC

nixcraft.com -    Expiration Date: 10-may-2009

nixcraft.org - Expiration Date:13-Aug-2007 14:58:30 UTC

nixcraft.biz - Domain Expiration Date:                      Fri Jun 01 23:59:59 GMT 2007

nixcraft.net -    Expiration Date: 11-dec-2007

nixcraft.info - Expiration Date:26-Jun-2007 11:05:13 UTC

cyberciti.biz - Domain Expiration Date:                      Tue Jun 30 23:59:59 GMT 2009

cyberciti.org - Expiration Date:25-May-2007 11:20:40 UTC

gite.in - Expiration Date:14-Sep-2007 06:47:36 UTC

nixcraft.in - Expiration Date:02-Feb-2008 05:33:08 UTC</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDkvMDgvZmluZC1kb21haW4tZXhwaXJhdGlvbi1kYXRlLzx3cHRiPkZpbmQgZG9tYWluIGV4cGlyYXRpb24gZGF0ZTx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/09/08/find-domain-expiration-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Look for obvious signs of trouble in Postfix</title>
		<link>http://pario.no/2007/07/30/look-for-obvious-signs-of-trouble-in-postfix/</link>
		<comments>http://pario.no/2007/07/30/look-for-obvious-signs-of-trouble-in-postfix/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 20:50:21 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[egrep]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/07/30/look-for-obvious-signs-of-trouble-in-postfix/</guid>
		<description><![CDATA[Postfix logs all failed and successful deliveries to a logfile. The file is usually called /var/log/maillog or /var/log/mail; the exact pathname is defined in the /etc/syslog.conf file. When Postfix does not receive or deliver mail, the first order of business is to look for errors that prevent Postfix from working properly: % egrep '(warning&#124;error&#124;fatal&#124;panic):' /some/log/file [...]]]></description>
			<content:encoded><![CDATA[<p> Postfix logs all failed and successful deliveries to a logfile. The file is usually called /var/log/maillog or /var/log/mail; the exact pathname is defined in the /etc/syslog.conf file.</p>
<p><span id="more-260"></span>When Postfix does not receive or deliver mail, the first order of business is to look for errors that prevent Postfix from working properly:</p>
<pre>% <strong>egrep '(warning|error|fatal|panic):' /some/log/file | more</strong></pre>
<p>Note: the most important message is near the BEGINNING of the output.  Error messages that come later are less useful.</p>
<p>The nature of each problem is indicated as follows:</p>
<ul>
<li> &#8220;<strong>panic</strong>&#8221; indicates a problem in the software itself that only a programmer can fix. Postfix cannot proceed until this is fixed.</li>
<li> &#8220;<strong>fatal</strong>&#8221; is the result of missing files, incorrect permissions, incorrect configuration file settings that you can fix.  Postfix cannot proceed until this is fixed.</li>
<li> &#8220;<strong>error</strong>&#8221; reports an error condition. For safety reasons, a Postfix process will terminate when more than 13 of these happen.</li>
<li> &#8220;<strong>warning</strong>&#8221; indicates a non-fatal error. These are problems that you may not be able to fix (such as a broken DNS server elsewhere on the network) but may also indicate local configuration errors that could become a problem later.</li>
</ul>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDcvMzAvbG9vay1mb3Itb2J2aW91cy1zaWducy1vZi10cm91YmxlLWluLXBvc3RmaXgvPHdwdGI%2BTG9vayBmb3Igb2J2aW91cyBzaWducyBvZiB0cm91YmxlIGluIFBvc3RmaXg8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/07/30/look-for-obvious-signs-of-trouble-in-postfix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell scripts for archiving digital photos in directories by month</title>
		<link>http://pario.no/2007/05/15/199/</link>
		<comments>http://pario.no/2007/05/15/199/#comments</comments>
		<pubDate>Tue, 15 May 2007 07:01:16 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Photo etc]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[egrep]]></category>
		<category><![CDATA[exiftags]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[JPG]]></category>
		<category><![CDATA[metacam]]></category>
		<category><![CDATA[NEF]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/15/199/</guid>
		<description><![CDATA[This is my version of the shell script &#8220;Shell scripts for archiving digital photos in directories by date&#8220;. It utilizes the exiftags command available in most linux distributions like Gentoo and debian Linux. Though the metacam program is also usefull since it can read Nikon NEF-files. Here&#8217;s an example of a directory tree they create: [...]]]></description>
			<content:encoded><![CDATA[<p>This is my version of the shell script &#8220;<a href="http://pario.no/wordpress/2007/05/15/shell-scripts-for-archiving-digital-photos-in-directories-by-date/">Shell scripts for archiving digital photos in directories by date</a>&#8220;. It utilizes  the <strong>exiftags</strong> command available in most linux distributions like Gentoo and debian Linux. Though the <strong>metacam</strong> program is also usefull since it can read Nikon <strong>NEF</strong>-files.</p>
<p>Here&#8217;s an example of a directory tree they create:</p>
<pre>
2006
  2006-10
       IMG_48324.JPG
       IMG_48325.JPG
       IMG_48326.JPG
       IMG_48331.JPG
       IMG_48333.JPG
       IMG_48334.JPG
       IMG_48337.JPG
  2006-11
       IMG_48338.JPG
  ...etc...</pre>
<p><strong>move-digiphotos</strong><br />
This bash script (move-digifotos) scans EXIF tags from .JPG files in current directory with <a href="http://freshmeat.net/projects/metacam/">metacam</a>, creates necessary directories under <strong>$BASEDIR</strong> and moves the files in them:</p>
<pre>
#!/bin/bash

# Reads EXIF creation date from all .JPG files in the
# current directory and moves them carefully under
#
#   $BASEDIR/YYYY/YYYY-MM/YYYY-MM-DD/
#
# ...where 'carefully' means that it does not overwrite
# differing files if they already exist and will not delete
# the original file if copying fails for some reason.
#
# It DOES overwrite identical files in the destination directory
# with the ones in current, however.
#
# This script was originally written and put into
# Public Domain by Jarno Elonen <elonen>; in June 2003.
# Feel free to do whatever you like with it.

BASEDIR=/home/backup/test

find -maxdepth 1 -name "*.JPG" | while read x; do
DATE=`exiftags "$x" | \
   egrep "^[ t]*Image Created:" | \
   sed -r "s/Image Created: ([0-9:]*).*/\1/"`
if [ ! -z "$DATE" ];
then
    YEAR=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\1/"`
    MONTH=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\2/"`
    if [ "$YEAR" -gt 0 ] &amp; [ "$MONTH" -gt 0 ]
    then
    INSTDIR=${BASEDIR}/${YEAR}/${YEAR}-${MONTH}
    install -d "$INSTDIR"
    INSTFILE="$INSTDIR/$x"
    if [ -e "$INSTFILE" ] &amp;&amp; ! cmp -s "$x" "$INSTFILE"
    then
        echo "WARNING: '$INSTFILE' exists already and is different from '$x'."
    else
        echo "Moving '$x'"
        cp -ax "$x" "$INSTFILE"
        if ! cmp -s "$x" "$INSTFILE"
        then
        echo "WARNING: copying failed somehow, will not delete original '$x'"
        else
        rm -f "$x"
        fi
    fi
    else
    echo "WARNING: '$x' doesn't contain date."
    fi
else
    echo "WARNING: '$x' doesn't contain date."
fi
done
</pre>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/freshmeat.net\/projects\/metacam\/"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMTUvMTk5Lzx3cHRiPlNoZWxsIHNjcmlwdHMgZm9yIGFyY2hpdmluZyBkaWdpdGFsIHBob3RvcyBpbiBkaXJlY3RvcmllcyBieSBtb250aDx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/15/199/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell scripts for archiving digital photos in directories by date</title>
		<link>http://pario.no/2007/05/15/shell-scripts-for-archiving-digital-photos-in-directories-by-date/</link>
		<comments>http://pario.no/2007/05/15/shell-scripts-for-archiving-digital-photos-in-directories-by-date/#comments</comments>
		<pubDate>Tue, 15 May 2007 06:57:04 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Photo etc]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[egrep]]></category>
		<category><![CDATA[EXIF]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[gphoto2]]></category>
		<category><![CDATA[JPG]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/15/shell-scripts-for-archiving-digital-photos-in-directories-by-date/</guid>
		<description><![CDATA[The fact that most digital cameras store the shooting dates inside JPEG files in the EXIF format makes it possible to automatically archive the photos by date right after they are downloaded, which is exactly what the scripts below do. Here&#8217;s an example of a directory tree they create: 1999 1999-07 1999-07-14 IMG_48324.JPG IMG_48325.JPG IMG_48326.JPG [...]]]></description>
			<content:encoded><![CDATA[<p>The fact that most digital cameras store the shooting dates inside JPEG files in the EXIF format makes it possible to automatically archive the photos by date right after they are downloaded, which is exactly what the scripts below do.</p>
<p>Here&#8217;s an example of a directory tree they create:</p>
<pre>
1999
  1999-07
     1999-07-14
       IMG_48324.JPG
       IMG_48325.JPG
       IMG_48326.JPG
     1999-07-17
       IMG_48331.JPG
       IMG_48333.JPG
       IMG_48334.JPG
       IMG_48337.JPG
  ...etc...</pre>
<p><strong>move-digiphotos</strong><br />
This bash script (move-digifotos) scans EXIF tags from .JPG files in current directory with <strong>metacam</strong>, creates necessary directories under <strong>$BASEDIR</strong> and moves the files in them:</p>
<pre>
#!/bin/bash

# Reads EXIF creation date from all .JPG files in the
# current direcotry and moves them carefully under
#
#   $BASEDIR/YYYY/YYYY-MM/YYYY-MM-DD/
#
# ...where 'carefully' means that it does not overwrite
# differing files if they already exist and will not delete
# the original file if copying fails for some reason.
#
# It DOES overwrite identical files in the destination directory
# with the ones in current, however.
#
# This script was originally written and put into
# Public Domain by Jarno Elonen <elonen> in June 2003.
# Feel free to do whatever you like with it.

  BASEDIR=/home/jarno/gfx

find -maxdepth 1 -name "*.JPG" | while read x; do
  DATE=`metacam "$x" | \
    egrep "^[ \t]*Image Capture Date:" | \
    sed -r "s/Image Capture Date: ([0-9:]*).*/\1/"`
  if [ ! -z "$DATE" ];
  then
    YEAR=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\1/"`
    MONTH=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\2/"`
    DAY=`echo $DATE | sed -r "s/([0-9]*):([0-9]*):([0-9]*)/\\3/"`
    if [ "$YEAR" -gt 0 ] &amp; [ "$MONTH" -gt 0 ] &amp; [ "$DAY" -gt 0 ]
    then
      INSTDIR=${BASEDIR}/${YEAR}/${YEAR}-${MONTH}/${YEAR}-${MONTH}-${DAY}
      install -d "$INSTDIR"
      INSTFILE="$INSTDIR/$x"
      if [ -e "$INSTFILE" ] &amp;&amp; ! cmp -s "$x" "$INSTFILE"
      then
        echo "WARNING: '$INSTFILE' exists already and is different from '$x'."
      else
        echo "Moving '$x'"
        cp "$x" "$INSTFILE"
        if ! cmp -s "$x" "$INSTFILE"
        then
          echo "WARNING: copying failed somehow, will not delete original '$x'"
        else
          rm -f "$x"
        fi
      fi
    else
      echo "WARNING: '$x' doesn't contain date."
    fi
  else
    echo "WARNING: '$x' doesn't contain date."
  fi
done
</elonen></pre>
<p><strong>fetch-digiphotos</strong><br />
The fetch-digiphotos script fetches pictures from a camera through <strong>gphoto2</strong> into a temporary directory under <strong>$TMPDIR</strong>, moves them with <strong>move-digiphotos</strong> and finally offers to delete them from the camera:</p>
<pre>
#!/bin/bash

# Downloads pictures from a digital camera using gphoto2,
# moves them with move-digiphotos.sh and optionally deletes
# them from the camera's memory.
#
# This script was originally written and put into
# Public Domain by Jarno Elonen <elonen> in June 2003.
# Feel free to do whatever you like with it.

TMPDIR=/home/jarno/gfx/tmp

if [ ! -d "$TMPDIR" ]; then
echo "*** Error: download directory '$TMPDIR' does not exist, aborting."
exit 1
fi
pushd "$TMPDIR" &gt; /dev/null

gphoto2 -P
if [ $? != 0 ]; then
echo "*** error executing gphoto2, aborting."
popd &gt; /dev/null
exit 1
fi

move-digiphotos

echo
echo -n "Delete pictures from camera? [y/N] "
read x
if [ $x == "y" ]; then
gphoto2 -D
fi
if [ $? != 0 ]; then
echo "Warning: error executing gphoto2."
popd &gt; /dev/null
exit 1
fi

echo "Done."
popd &gt; /dev/null
</elonen></pre>
<p>Kilde: <a href="http://elonen.iki.fi/code/misc-notes/digiphoto-archive-script/index.html">Jarno Elonen, 2003-06-17</a></p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/elonen.iki.fi\/code\/misc-notes\/digiphoto-archive-script\/index.html"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMTUvc2hlbGwtc2NyaXB0cy1mb3ItYXJjaGl2aW5nLWRpZ2l0YWwtcGhvdG9zLWluLWRpcmVjdG9yaWVzLWJ5LWRhdGUvPHdwdGI%2BU2hlbGwgc2NyaXB0cyBmb3IgYXJjaGl2aW5nIGRpZ2l0YWwgcGhvdG9zIGluIGRpcmVjdG9yaWVzIGJ5IGRhdGU8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/15/shell-scripts-for-archiving-digital-photos-in-directories-by-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utskrift av port, pid og daemon navn v.h.a netstat</title>
		<link>http://pario.no/2007/02/01/utskrift-av-port-pid-og-daemon-navn-vha-netstat/</link>
		<comments>http://pario.no/2007/02/01/utskrift-av-port-pid-og-daemon-navn-vha-netstat/#comments</comments>
		<pubDate>Thu, 01 Feb 2007 21:48:35 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[egrep]]></category>
		<category><![CDATA[gawk]]></category>
		<category><![CDATA[netstat]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/02/01/utskrift-av-port-pid-og-daemon-navn-vha-netstat/</guid>
		<description><![CDATA[netstat -nap&#124; egrep "(0.0.0.0).*(0.0.0.0).*LISTEN" &#124; gawk '{print $4 ":" $7}' &#124; egrep -o ":(.*)" &#124; cut -c 2-&#124;sed 's/\//\:/']]></description>
			<content:encoded><![CDATA[<p><code>netstat -nap| egrep "(0.0.0.0).*(0.0.0.0).*LISTEN" | gawk '{print $4 ":" $7}' | egrep -o ":(.*)" | cut -c 2-|sed  's/\//\:/'</code></p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDIvMDEvdXRza3JpZnQtYXYtcG9ydC1waWQtb2ctZGFlbW9uLW5hdm4tdmhhLW5ldHN0YXQvPHdwdGI%2BVXRza3JpZnQgYXYgcG9ydCwgcGlkIG9nIGRhZW1vbiBuYXZuIHYuaC5hIG5ldHN0YXQ8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/02/01/utskrift-av-port-pid-og-daemon-navn-vha-netstat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

