<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;AkQBR3ozfCp7ImA9WhRRFE4.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204</id><updated>2011-11-27T15:59:16.484-08:00</updated><title>UNIX Best Practices : SHELL, PERL, AWK, SED, GREP, VI</title><subtitle type="html">This blog is all about UNIX/LINUX based best practices which are helpful in career development and interview preparation.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://manutechie.blogspot.com/" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/UnixBestPracticesShellPerlAwkSedGrepVi" /><feedburner:info uri="unixbestpracticesshellperlawksedgrepvi" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>UnixBestPracticesShellPerlAwkSedGrepVi</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;DkAFRH8ycSp7ImA9WhdQF0o.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-3372147550013498313</id><published>2011-08-19T10:24:00.000-07:00</published><updated>2011-08-19T10:25:15.199-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T10:25:15.199-07:00</app:edited><title>Adding 30 days to current date using PERL inside SHELL</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="background-color: white; line-height: 15px;"&gt;&lt;span class="Apple-style-span" style="color: blue; font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="yiv864507585MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white; font-family: 'Trebuchet MS', sans-serif;"&gt;#! /usr/bin/ksh&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv864507585MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv864507585MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white; font-family: 'Trebuchet MS', sans-serif;"&gt;dt1=`perl -l -e '$date=(localtime(time + (30 * 24 * 60 *60))); print $date;'`&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv864507585MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv864507585MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white; font-family: 'Trebuchet MS', sans-serif;"&gt;dt=`echo $dt1|awk '{if($3&amp;lt;10) print $1" "$2" 0"$3" "$4" "$5;else print $0}'`&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv864507585MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv864507585MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white; font-family: 'Trebuchet MS', sans-serif;"&gt;echo $dt|awk '{print $5"-"$2"-"$3"23:59:59"}'|sed -e 's/Jan/01/g'\;'s/Feb/02/g'\;'s/Mar/03/g'\;'s/Apr/04/g'\;'s/May/05/g'\;'s/Jun/06/g'\;'s/Jul/07/g'\;'s/Aug/08/g'\;'s/Sep/09/g'\;'s/Oct/10/g'\;'s/Nov/11/g'\;'s/Dec/12/g'&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-3372147550013498313?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/a4kpiDsU5RA_1EtbLWYhCNkF8yo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/a4kpiDsU5RA_1EtbLWYhCNkF8yo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/a4kpiDsU5RA_1EtbLWYhCNkF8yo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/a4kpiDsU5RA_1EtbLWYhCNkF8yo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/9CssWlOclWE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/3372147550013498313/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=3372147550013498313" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/3372147550013498313?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/3372147550013498313?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/9CssWlOclWE/adding-30-days-to-current-date-using.html" title="Adding 30 days to current date using PERL inside SHELL" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2011/08/adding-30-days-to-current-date-using.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQARX07cSp7ImA9WhdQF0o.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-2226983224849242932</id><published>2011-08-19T10:19:00.000-07:00</published><updated>2011-08-19T10:19:04.309-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-19T10:19:04.309-07:00</app:edited><title>Print 3 lines before pattern match using sed and awk ..</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: blue; font-family: 'Trebuchet MS', sans-serif; line-height: 15px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;b style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;u style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;To reverse a file using awk and print next three lines after pattern match (Including pattern):&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;awk '{ a[i++] = $0 } END { for (j=i-1; j&amp;gt;=0;) print a[j--] }'&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;abcd.txt&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&amp;nbsp;|sed -n '/&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;MANU&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;/{p;n;p;n;p;n;p;}' &amp;gt;&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;abcd_new.txt&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;(This can be used when you want to print 3 lines before pattern match, including pattern. Logic: reverse a file and print 3 lines after pattern match.)&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;b style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;u style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;How to reverse a file using awk:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;awk '{ a[i++] = $0 } END { for (j=i-1; j&amp;gt;=0;) print a[j--] }' abcd.txt&lt;/span&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;b style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;u style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;How to reverse a file using sed:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="yiv1294120378MsoNormal" style="display: block; line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="line-height: 1.2em; outline-color: initial; outline-style: none; outline-width: initial;"&gt;sed -n '1!G;h;$p' abcd.txt&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-2226983224849242932?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zncbZk-ZpnzJYgY0PbnyJ5lCEsA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zncbZk-ZpnzJYgY0PbnyJ5lCEsA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zncbZk-ZpnzJYgY0PbnyJ5lCEsA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zncbZk-ZpnzJYgY0PbnyJ5lCEsA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/qMT4Pj8kN6k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/2226983224849242932/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=2226983224849242932" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/2226983224849242932?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/2226983224849242932?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/qMT4Pj8kN6k/print-3-lines-before-pattern-match.html" title="Print 3 lines before pattern match using sed and awk .." /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2011/08/print-3-lines-before-pattern-match.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUNRXg5eyp7ImA9WhdQE0U.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-8396291348476849065</id><published>2011-08-14T22:24:00.000-07:00</published><updated>2011-08-14T22:31:34.623-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-14T22:31:34.623-07:00</app:edited><title>Print one line before pattern match using sed in UNIX.</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="background-color: #444444; color: lime; font-family: 'Trebuchet MS', sans-serif; font-size: large; line-height: 15px;"&gt;&lt;b&gt;sed -n -e '/manu/{x;p;x;p;}' -e h test.txt&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-8396291348476849065?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_o3Ya7iEFLdpQf7JmxRGx4v2RE8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_o3Ya7iEFLdpQf7JmxRGx4v2RE8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_o3Ya7iEFLdpQf7JmxRGx4v2RE8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_o3Ya7iEFLdpQf7JmxRGx4v2RE8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/WEZhXEMnQ0E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/8396291348476849065/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=8396291348476849065" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/8396291348476849065?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/8396291348476849065?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/WEZhXEMnQ0E/print-one-line-before-pattern-match.html" title="Print one line before pattern match using sed in UNIX." /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2011/08/print-one-line-before-pattern-match.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcESX49cCp7ImA9Wx9TFUk.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-1825356441030790529</id><published>2010-11-23T11:18:00.000-08:00</published><updated>2010-11-23T11:20:08.068-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-23T11:20:08.068-08:00</app:edited><title>Adding one month (30-31 days) in UNIX SOLARIS</title><content type="html">&lt;span class="Apple-style-span" style="line-height: 15px; "&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;#! /usr/bin/ksh&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;d=`date +%d`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;m=`date +%m`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;y=`date +%Y`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;if [ $m%2 -eq 0 ]&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;then&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; d1=`expr $d + 30`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; d=expr $d1 - 30`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;else&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; d1=`expr $d + 31`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; d=expr $d1 - 31`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;if [ $m -eq 12 ]&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;then&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; y=`expr $y + 1`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; m=0&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;m=`expr $m + 1`&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;if [ $m -lt 10 ]&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;then&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;m=0$m&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;echo "$y-$m-$d"&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="yiv782137395MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;exit 0&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-1825356441030790529?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/jWHaVEQw6OnSprXALQ3rCM2T3xA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jWHaVEQw6OnSprXALQ3rCM2T3xA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/jWHaVEQw6OnSprXALQ3rCM2T3xA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jWHaVEQw6OnSprXALQ3rCM2T3xA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/caBi1UVRMz4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/1825356441030790529/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=1825356441030790529" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/1825356441030790529?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/1825356441030790529?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/caBi1UVRMz4/adding-one-month-30-31-days-in-unix.html" title="Adding one month (30-31 days) in UNIX SOLARIS" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/11/adding-one-month-30-31-days-in-unix.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cGR30yfyp7ImA9WxFVFU4.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-3877090727361474317</id><published>2010-06-14T11:07:00.000-07:00</published><updated>2010-06-14T11:10:26.397-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-14T11:10:26.397-07:00</app:edited><title>sort a delimited file on the basis of a column</title><content type="html">&lt;span style="font-family: trebuchet ms; color: rgb(51, 255, 51); font-weight: bold;font-size:100%;" &gt;sort -t":" -k3 filename&lt;/span&gt;&lt;span style="font-family: trebuchet ms; color: rgb(51, 255, 51);font-size:100%;" &gt;&lt;span style="font-weight: bold;"&gt;.txt&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 51);"&gt;(The above will sort a file filename.txt which is ":" delimited on the basis of third column.)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-3877090727361474317?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qDnDC9xE4tknCTsFlYdrPb0lWk8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qDnDC9xE4tknCTsFlYdrPb0lWk8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qDnDC9xE4tknCTsFlYdrPb0lWk8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qDnDC9xE4tknCTsFlYdrPb0lWk8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/32ReEAxVdcg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/3877090727361474317/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=3877090727361474317" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/3877090727361474317?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/3877090727361474317?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/32ReEAxVdcg/sort-delimited-file-on-basis-of-column.html" title="sort a delimited file on the basis of a column" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/06/sort-delimited-file-on-basis-of-column.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMDQHk9eyp7ImA9WxFRGUU.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-4867534916805170782</id><published>2010-05-04T07:10:00.000-07:00</published><updated>2010-05-04T07:14:31.763-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-04T07:14:31.763-07:00</app:edited><title>Print every 6th line of a file ..</title><content type="html">&lt;span style="font-weight: bold;"&gt;&lt;span style="color: rgb(51, 255, 51);font-family:trebuchet ms;font-size:100%;"  &gt;&lt;span style="font-size:180%;"&gt;T&lt;/span&gt;he below awk command will print every 6th line of a file test.txt starting from line number one.&lt;br /&gt;&lt;br /&gt;awk '{if(NR%6==1) print $0}' test.txt&lt;br /&gt;&lt;br /&gt;(Note: Print every nth line using awk.)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-4867534916805170782?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/VIcu5Ldu3MBaylga2Gi2H_pJxBw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VIcu5Ldu3MBaylga2Gi2H_pJxBw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/VIcu5Ldu3MBaylga2Gi2H_pJxBw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VIcu5Ldu3MBaylga2Gi2H_pJxBw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/koI65nMYue4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/4867534916805170782/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=4867534916805170782" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4867534916805170782?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4867534916805170782?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/koI65nMYue4/print-every-6th-line-of-file.html" title="Print every 6th line of a file .." /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/05/print-every-6th-line-of-file.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUECRnkzfSp7ImA9WxBVEUs.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-8760743645731596854</id><published>2010-02-14T09:13:00.001-08:00</published><updated>2010-02-14T09:14:27.785-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-14T09:14:27.785-08:00</app:edited><title>Sed Options</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5POWgCjhzBk/S3gvavBhQII/AAAAAAAAF1g/S9wpYDgZQcg/s1600-h/New+Picture.bmp"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 291px;" src="http://2.bp.blogspot.com/_5POWgCjhzBk/S3gvavBhQII/AAAAAAAAF1g/S9wpYDgZQcg/s400/New+Picture.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5438148686395818114" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-8760743645731596854?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nhDBETYJCLP-MS9VaiVCGfzuPUY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nhDBETYJCLP-MS9VaiVCGfzuPUY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nhDBETYJCLP-MS9VaiVCGfzuPUY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nhDBETYJCLP-MS9VaiVCGfzuPUY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/y3nVGqAt6rA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/8760743645731596854/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=8760743645731596854" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/8760743645731596854?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/8760743645731596854?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/y3nVGqAt6rA/sed-options.html" title="Sed Options" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_5POWgCjhzBk/S3gvavBhQII/AAAAAAAAF1g/S9wpYDgZQcg/s72-c/New+Picture.bmp" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/02/sed-options.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQBRXw9fip7ImA9WxBVEUs.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-8855085480197649979</id><published>2010-02-14T08:34:00.000-08:00</published><updated>2010-02-14T09:09:14.266-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-14T09:09:14.266-08:00</app:edited><title>use sed when ....</title><content type="html">&lt;pre&gt;&lt;span style=";font-family:trebuchet ms;font-size:130%;"  &gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 0);"&gt;# insert a blank line above every line which matches "regex"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 51);"&gt; sed '/regex/{x;p;x;}' OR &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:trebuchet ms;font-size:130%;"  &gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 51);"&gt; sed '/regex/{x;G;}'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:trebuchet ms;font-size:130%;"  &gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 0);"&gt;# insert a blank line below every line which matches "regex"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 51);"&gt; sed '/regex/G'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 0);"&gt;# insert a blank line above and below every line which matches "regex"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 51);"&gt; sed '/regex/{x;p;x;G;}'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span style=";font-family:trebuchet ms;font-size:130%;"  &gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 0);"&gt;# remove the header of a file&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:trebuchet ms;font-size:130%;"  &gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 51);"&gt;sed '/1,1d' filename&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-8855085480197649979?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wINDg2aawX6TZzMnXZpduO5A99Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wINDg2aawX6TZzMnXZpduO5A99Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wINDg2aawX6TZzMnXZpduO5A99Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wINDg2aawX6TZzMnXZpduO5A99Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/D3mnVPFRo3g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/8855085480197649979/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=8855085480197649979" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/8855085480197649979?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/8855085480197649979?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/D3mnVPFRo3g/use-sed-when.html" title="use sed when ...." /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/02/use-sed-when.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMDSHcyeCp7ImA9WxBXEko.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-4349642765198384632</id><published>2010-01-23T10:14:00.001-08:00</published><updated>2010-01-23T10:14:39.990-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-23T10:14:39.990-08:00</app:edited><title>Basic UNIX Questions</title><content type="html">&lt;span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: 13px; font-weight: bold; line-height: 15px; "&gt;&lt;font class="Apple-style-span" color="#66FF99"&gt;All questions are for command line use in UNIX environments. &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: How do you display your running kernel version? (Solaris, AIX, Linux)&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: Linux # uname –r , Solaris # showrev&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; Q: Which command do you use to display a table of running processes? (Solaris, AIX, Linux)&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;A: Linux # ps –ef and top , Solaris # prstat &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: Which file do you modify to configure a domain name resolver? (Solaris, AIX, Linux)&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: Linux # /etc/resolv.conf , Solaris # /etc/resolv.conf&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; Q: Which file contains a list of locally defined hostnames and corresponding IP addresses? (Solaris, AIX, Linux)&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;A: Linux # /etc/hosts , Solaris # /etc/hosts and linked file /etc/inet/hosts &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: How do you display a routing table? (Solaris, AIX, Linux)&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: Linux # ip route show or #netstat –nr or #route –n and Solaris # netstat –nr and #route -n&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; Q: Which command would you use to view partitions and their sizes on Solaris?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;A: # df -kh&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: Which OpenBoot command would you use to print/view OpenBoot environment variables on a SUN server?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: #printenv&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: What does "ypwhich" command do? (Solaris, AIX, Linux)&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: # Will display NIS server to which client is connected to and which NIS Server is master for particular map specified with this command&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: which command would you use to create an OS user on Solaris and Linux?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: Linux # useradd and Solaris #useradd&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; Q: Which file contains passwords for local users on Solaris, Linux and on AIX?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;A: Linux #/etc/shadow and Solaris # /etc/shadow&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: Which command would you use to list partitions on Linux?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: Linux # mount –l or # df -kh&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; Q: Which command/commands would you use to manage installed packages on RedHat Linux?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;A: Linux # rpm &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: What is the default port for SSH server? &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: 22&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: Which command/commands would you use to manage installed packages on Solaris?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: #pkginfo #pkgrm # pkgadd #pkgchk&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; Q: What command would you use to install an OS patch on Solaris?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;A: #showrev –p and #patchadd -p&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: Which Veritas command would you use to display a list of Veritas volumes?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: # vxprint&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: Which Veritas command would you use to display a list of disks on a system?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: # vxdx list&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: What is the main system configuration utility in AIX?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: &lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;Q: Which file has a list of filesystems to be mounted at boot time on Solaris, Linux and AIX?&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt; A: Linux # /etc/fstab and Solaris #/etc/vfstab&lt;/font&gt;&lt;br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;/span&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-4349642765198384632?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/WU03FWsDyfdXodSGWGtP_JYNmhA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WU03FWsDyfdXodSGWGtP_JYNmhA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/WU03FWsDyfdXodSGWGtP_JYNmhA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WU03FWsDyfdXodSGWGtP_JYNmhA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/UkoMIBjAYk4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/4349642765198384632/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=4349642765198384632" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4349642765198384632?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4349642765198384632?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/UkoMIBjAYk4/basic-unix-questions.html" title="Basic UNIX Questions" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/01/basic-unix-questions.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcCQn87eSp7ImA9WxBXEko.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-4758386428919954854</id><published>2010-01-23T10:07:00.001-08:00</published><updated>2010-01-23T10:07:43.101-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-23T10:07:43.101-08:00</app:edited><title>how to get patterns of file 1 "a" in file 2 "b"</title><content type="html">&lt;span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: 13px; color: rgb(255, 255, 255); line-height: 15px; "&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; color: initial; "&gt; &lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;trebuchet ms&amp;#39;; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 255, 51); "&gt;#! /usr/bin/sh&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; color: initial; "&gt; &lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;trebuchet ms&amp;#39;; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 255, 51); "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; color: initial; "&gt; &lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;trebuchet ms&amp;#39;; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 255, 51); "&gt;while read line&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; color: initial; "&gt; &lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;trebuchet ms&amp;#39;; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 255, 51); "&gt;do&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; color: initial; "&gt; &lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;trebuchet ms&amp;#39;; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 255, 51); "&gt;grep $line b &amp;gt;&amp;gt;final&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; color: initial; "&gt; &lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium; "&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;trebuchet ms&amp;#39;; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 255, 51); "&gt;done&amp;lt;a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;/span&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-4758386428919954854?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ibgAy9_pkkn7nroqMi-fsMtmBI8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ibgAy9_pkkn7nroqMi-fsMtmBI8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ibgAy9_pkkn7nroqMi-fsMtmBI8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ibgAy9_pkkn7nroqMi-fsMtmBI8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/gw-8F2qlb_o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/4758386428919954854/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=4758386428919954854" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4758386428919954854?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4758386428919954854?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/gw-8F2qlb_o/how-to-get-patterns-of-file-1-in-file-2_23.html" title="how to get patterns of file 1 &quot;a&quot; in file 2 &quot;b&quot;" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/01/how-to-get-patterns-of-file-1-in-file-2_23.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UDQHw6eip7ImA9WxBXEks.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-5657760119502034688</id><published>2010-01-23T09:53:00.000-08:00</published><updated>2010-01-23T09:54:31.212-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-23T09:54:31.212-08:00</app:edited><title>how to get yesterday date in unix</title><content type="html">&lt;span class="Apple-style-span" style="font-family: arial, helvetica, clean, sans-serif; font-size: 13px; line-height: 15px; "&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span class="Apple-style-span"  style="font-family:Arial, sans-serif;"&gt;&lt;span class="Apple-style-span" style="line-height: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; display: block; "&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="font-family:'trebuchet ms';"&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt; YEST=`TZ="GMT+24" date +'%m/%d/%Y'`; echo $YEST&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-5657760119502034688?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wLQBaXRaLgpnlD8VvlnN_Xfr9IQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wLQBaXRaLgpnlD8VvlnN_Xfr9IQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wLQBaXRaLgpnlD8VvlnN_Xfr9IQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wLQBaXRaLgpnlD8VvlnN_Xfr9IQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/6H-C8Ou3_vo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/5657760119502034688/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=5657760119502034688" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/5657760119502034688?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/5657760119502034688?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/6H-C8Ou3_vo/how-to-get-yesterday-date-in-unix.html" title="how to get yesterday date in unix" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/01/how-to-get-yesterday-date-in-unix.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0YMRXc9eCp7ImA9WxBXEks.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-6198966712159688887</id><published>2010-01-23T09:50:00.000-08:00</published><updated>2010-01-23T09:53:04.960-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-23T09:53:04.960-08:00</app:edited><title>Print next 7 lines of the file sample2 after pattern match from file sample1:</title><content type="html">&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:arial, helvetica, clean, sans-serif;font-size:13px;"&gt;&lt;p class="MsoNormal"  style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline- display: block; color:initial;"&gt;&lt;span class="Apple-style-span"  style="font-family:'Vodafone Rg', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline- display: block; color:initial;"&gt;&lt;span style="line-height: 1.2em; outline-style: none; outline-width: initial; outline- color:initial;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:'trebuchet ms';"&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;for i in `cat sample1`;do sed -n "/$i/{p;n;p;n;p;n;p;n;p;n;p;n;p;n;G;p;}" sample2 ; done&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.2em; outline-style: none; outline-width: initial; outline- display: block; color:initial;"&gt;&lt;span class="Apple-style-span"  style="font-family:'Vodafone Rg', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-6198966712159688887?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/sDSro61_q_TQ6_IaYOJYD_2GfAg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sDSro61_q_TQ6_IaYOJYD_2GfAg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/sDSro61_q_TQ6_IaYOJYD_2GfAg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sDSro61_q_TQ6_IaYOJYD_2GfAg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/_w6gKLW1TIs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/6198966712159688887/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=6198966712159688887" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6198966712159688887?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6198966712159688887?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/_w6gKLW1TIs/print-next-7-lines-of-file-sample2.html" title="Print next 7 lines of the file sample2 after pattern match from file sample1:" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2010/01/print-next-7-lines-of-file-sample2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04BRHY8fip7ImA9WxNSEUo.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-287428839518291394</id><published>2009-06-06T01:38:00.001-07:00</published><updated>2009-08-24T22:59:15.876-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-24T22:59:15.876-07:00</app:edited><title>UNIX interview questions and best practices.....</title><content type="html">&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,255,51)font-size:100%;" &gt;&lt;span style="font-family:trebuchet ms;"&gt;Q1.Write a shell script in Linux to shift all characters in a file forward by five characters. (Thus "a" becomes "f'").&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: cat test  tr '[a-z A-Z]' '[f-za-e F-ZA-E]'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Q2.I have 2 files:-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;file1 and file2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;file1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SEED&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;RPTT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;TST8&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;file2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SEED:db:Y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;RPTT:db:Y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SED8:db:N&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SEED:db:N&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;TST8:db2:Y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;TRN8:db3:N&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;CNV8:db4:Y&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;I have to change third field of file2 to "y" for every entry in file1 matches first filed of file 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;and rest to N&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;I want file 2 like :-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;as file 1 has (SEED,RPTT,TST8) so in file2 I want to do third field "y" for those entries(which is first field in file2).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;In rest I want to convert to "N"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SEED:db:Y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;RPTT:db:Y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SED8:db:N&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SEED:db:Y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;TST8:db2:Y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;TRN8:db3:N&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;CNV8:db4:N&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: while IFS=: read a b _ ; do echo -n "$a:$b:" ; ([[ $(grep -w $a file1.txt) ]] &amp;amp;&amp;amp; echo Y)  echo N ; done &amp;lt;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q3. How u convert string "hi manu how are you?" to "Hi Manu How Are You?" &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: echo "hi manu how are you"sed -e 's/ [a-z]/\U&amp;amp;/g'\;'s/^[a-z]/\U&amp;amp;/g'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;OR&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;echo "hi manu how are you"  sed 's/\&amp;lt;[a-z]*\&amp;gt;/\u&amp;amp;/g'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q4. write a shell script that counts a number of unique word contained in the file and print them in alphabetical order line by line?&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: $ rm -f res res1 ; while read line ; do cat uniqtest  grep -wc $line &amp;gt;&amp;gt;res1 ; echo "$line :-&amp;gt; Count=" &amp;gt;&amp;gt;res ;done final_temp ; cat final_tempsort -u &amp;gt;final ; rm -f res res1 final_temp1&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;(Check file "final" for output)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q5. How to rename all the files in a folder having specific extension? Example: I have some files with extension (.txt) in a folder name 'Test'. I have to rename all the .txt files in a test and its subdirectories to .my extension. &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: for file in `ls` ; do NEW=`echo $file  sed 's/.txt/.my/g'` ; mv $file $NEW ; done&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q6. write a shell script to identify the given string is palindrome or not? &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;#! /usr/bin/sh&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;len=0&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;i=1&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;tag=0&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;echo -n "Enter a String: "&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;read str&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;len=`echo $str  wc -c`&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;len=`expr $len - 1`&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;halfLen=`expr $len / 2`&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;while [ $i -le $halfLen ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;do&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;c1=`echo $strcut -c$i`&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;c2=`echo $strcut -c$len`&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;if [ $c1 != $c2 ] ; then&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;i=$halfLen&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;tag=1&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;fi&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;i=`expr $i + 1`&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;len=`expr $len - 1`&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;done&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;if [ $tag -eq 0 ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;then&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;echo "String is Palindrome"&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;echo "String is not Palindrome"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;fi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q7. one file is a.txt which has 4 fields/columns, where as each field has separated by space and that field contains some data like below&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;ram usa 105 25&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;rag uk 115 26&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;pat ind 234 23&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;sah 425 24&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;tat usa 344 28&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;rat brz 536 29&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;now i want only 2nd field data, that should be like this&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;usa&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;uk&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;ind&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;usa&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;brz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;(i.e. It should print blank line for the second field if it doesnt have country defined)&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: awk 'NF &amp;lt; 4 {$2=""} { print $2 }' a.txt&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q8. How to change all .my files to .txt in current directory??&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Solution: for i in `ls *.my` ; do NEW=`echo $ised -e 's/.my/.txt/g'` ; mv $i $NEW ; done&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q9. How to change all .extn files to .my in entire directory recursively??&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Solution:&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;find ./ -type f grep ".extn$" &amp;gt;files.txt;for i in `cat files.txt`;do NEW=`echo $ised 's/.extn/.my/g'`;mv "${i}" "${NEW}";done;rm -f files.txt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q10: What is umask??&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: umask is used to set default permission level in entire unix system. It can be set in .kshrc/.bashrc/.cshrc or init (So that to load at the time of login into shell)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q11. What is inode??&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer : inode represents any file/directory residing in your unix system with a numner known as inode number. It is unique for every file/dir. It is basically a reference that kernel use for any work related to that entity. "ls -i filename" will give you the inode number of that particu;ar file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q12. Explain general commands like ps,df, export, env, ufsdump, tar, cron, system.&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: EASY ONE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q13. Explain the make utility in unix?? what are the parameters of a makefile and how to use them. What are macros in makefile.&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: Unix make utility is used to build a software package. It requires a makefile where all the bunch of the scripts/codes/programs are declared/defined. The main parameters of the make file are variable declaration, Macro declaration, Phony Target declaration and Clean-up block. Macros in a makefile represents the order in which the scripts would get executed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q14. What are the benefits of makefile over shell script??&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: Using makefile one can run the different scripts or programs or codes in one go. This can also be done by making a wrapper shell script which can execute the different scripts in one go. But then it would not be termed as a package because when we say a package it means that we have one installer (.exe) which can execute the bunch more efficiently and also this .exe will be in encrypted format. So in order to maintain efficiency and security makefile is given precedence over wrapper shell scripts.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q15. What are hard links in UNIX??&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: A hard link is a reference to a file or directory that appears just like a file or directory, not a link. Hard links only work within a filesystem. In other words, don't use hard links between mounted filesystems. A hard link is only a reference to the original file, not a copy of the file. If the original file is deleted, the information will be lost.&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;To create a hard link of the file /export/home/fred/stuff to /var/tmp/thing, use:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;ln /export/home/fred/stuff /var/tmp/thing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;The syntax for creating a hard link of a directory is the same. To create a hard link of /var/www/html to /var/www/webroot, use:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;ln /var/www/html /var/www/webroot&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q16. What are the soft/symbolic links in unix ??&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: A symbolic link is a pointer to another file or directory. It can be used just like the original file or directory. A symbolic link appears in a long listing (ls -l) with a reference to the original file/directory. A symbolic link, as opposed to a hard link, is required when linking from one filesystem to another and can be used within a filesystem as well.&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;To create a symbolic link, the syntax of the command is similar to a copy or move command: existing file first, destination file second. For example, to link the directory /export/space/common/archive to /archive for easy access, use:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;ln -s /export/space/common/archive /archive&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;To link the runtime control script /etc/init.d/httpd to /etc/rc2.d/S77httpd, use:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;cd /etc/rc2.d&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;ln -s ../init.d/httpd S77httpd&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q17. What is a command to kill the last background job??&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: kill $!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q18. Bring a job to foreground by specifying its job number after the percent sign.&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: fg %jobnumber&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;(Note: jobnumber can be obtained by using jobs -l command)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q19. Explain top command.&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. Most features can either be selected by an interactive command or by specifying the feature in the personal or system-wide configuration file. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,51);font-family:trebuchet ms;" &gt;Q20. Write a script which give you those records which are having CPU utilization more than 80%.&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;Answer: df -k  awk 'NR==1{print $1"\t"$5"\t"$6}sub("%","",$5){if($5 &amp;gt;= 80) print $1"\t"$5"%\t"$NF}'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,255,51)font-size:100%;" &gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;&lt;span style="color:#33ff33;"&gt;Q21. How to pass arguments in an awk script??&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ffff33;"&gt;Answer: Using, cat a.txtawk -v awk_var="$shell_var" '{print $1 "\t" awk_var}'&lt;br /&gt;e.g. #! /usr/bin/sh&lt;br /&gt;var=$*&lt;br /&gt;cat ussd.txt &gt;offpeak_input.txt&lt;br /&gt;cat offpeaknawk -v var1="$var" '{print  "\"1-"$1"\"""""\""$2"\"""""1006"""""$3"""0""""-1""""-1""""\""var1" .Account balance is Rs.&lt;gafloat.ma###,###.##&gt;.Bonus minutes&lt;gaint.of###,###.##&gt;.\""}'&gt;&gt;offpeak_input.txt&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,255,51)font-size:100%;" &gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;&lt;span style="COLOR: rgb(255,255,0);font-family:trebuchet ms;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,255,255)"&gt;!!!!!!!!!! CHEEEEEEEEEEEERRRRRRRRRZZZZZZZZZZZZZZZZZZZZZZZZZ !!!!!!!!!!&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-287428839518291394?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_5XEyvnIPKpJhY0YENLvd-btu3g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_5XEyvnIPKpJhY0YENLvd-btu3g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_5XEyvnIPKpJhY0YENLvd-btu3g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_5XEyvnIPKpJhY0YENLvd-btu3g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/5JdaAzAtD14" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/287428839518291394/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=287428839518291394" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/287428839518291394?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/287428839518291394?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/5JdaAzAtD14/unix-interview-questions-and-best_06.html" title="UNIX interview questions and best practices....." /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2009/06/unix-interview-questions-and-best_06.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8AR3c-eSp7ImA9WxJSF08.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-6746426773210952786</id><published>2009-05-07T13:24:00.001-07:00</published><updated>2009-05-07T13:24:06.951-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-07T13:24:06.951-07:00</app:edited><title>Daily Purpose sed commands</title><content type="html">&lt;div style="color: rgb(102, 51, 255);" class="gmail_quote"&gt;&lt;font style="color: rgb(255, 255, 255);" size="2"&gt;&lt;b style="font-family: verdana,sans-serif;"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Replace Text :&lt;/span&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/Old/New/g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Remove Text :&lt;/span&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/Text//g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;Remove Text From Front :&lt;/span&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/^Text//g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;Remove Text From End : &lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/Text\$//g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;s/Text$//g&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Insert Text in Front :&lt;/span&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/^/Text/g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;Append Text to End :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/\$/Text/g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;s/$/Text/g&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Truncate :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/Text.*//&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;cut -c5-8&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Downshift and Upshift :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;tr &amp;#39;[A-Z]&amp;#39; &amp;#39;[a-z]&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;tr &amp;#39;[a-z]&amp;#39; &amp;#39;[A-Z]&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Change Tabs to Spaces :&lt;/span&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/&amp;lt;tab&amp;gt;/ /g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Change Multiple Spaces to a Single Space :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/  */ /g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Change Whitespaces to a Single Space :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/[&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;][&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;]*/&amp;lt;space&amp;gt;/g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;Delete Leading Whitespaces:&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;s/^[&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;]*//g&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Delete Trailing Whitespaces:&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;s/[&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;]*$//g&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Delete Lines:&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;quot;/Text/d&amp;quot; &lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;grep -v &amp;quot;Text&amp;quot;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;Delete Empty Lines:&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;/^*$/d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;/^[&amp;lt;tab&amp;gt;&amp;lt;space&amp;gt;]*$/d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;  &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Delete First Line:&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;1d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;1,7d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Delete Last Line : &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;$d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Print First Line :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -n &amp;#39;1p&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;2,$d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;1q&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Print Last Line :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -n &amp;#39;$p&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Delete Comments :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;/^#/d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;s/#.*//&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;Delete Text Between Keywords :&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;/Keyword1/,/Keyword2/d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;  &lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;/^Keyword1$/,/^Keyword2$/d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Extract Text Between Keywords : &lt;br&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;sed -e &amp;#39;/^Keyword1$/,/^Keyword2$/!d&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Print Odd Lines : &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;cat -n file |  sed -e &amp;#39;/.....[02468]/d&amp;#39; -e &amp;#39;s/^.......//&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;  &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Print Even Lines : &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;cat -n file |  sed -e &amp;#39;/.....[13579]/d&amp;#39; -e &amp;#39;s/^.......//&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Read a File Backwards : &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;cat -n file | sort -nr | sed &amp;#39;s/^.......//&amp;#39;&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt; &lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Convert &amp;lt; &amp;gt; into LTGT : &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;cat $* | sed -e &amp;#39;s/&amp;lt;/\&amp;amp;lt;/g&amp;#39; -e &amp;#39;s/&amp;gt;/\&amp;amp;gt;/g&amp;#39;&lt;/span&gt; &lt;br&gt; &lt;br&gt;&lt;br&gt;&lt;/b&gt;&lt;/font&gt; &lt;/div&gt;&lt;br style="color: rgb(102, 51, 255);"&gt;&lt;br style="color: rgb(102, 51, 255);" clear="all"&gt;&lt;br style="color: rgb(102, 51, 255);"&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-6746426773210952786?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lg0PW4C8YcvnTZIsi17h_OEkI_4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lg0PW4C8YcvnTZIsi17h_OEkI_4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lg0PW4C8YcvnTZIsi17h_OEkI_4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lg0PW4C8YcvnTZIsi17h_OEkI_4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/DX4LedzzGVA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/6746426773210952786/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=6746426773210952786" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6746426773210952786?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6746426773210952786?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/DX4LedzzGVA/daily-purpose-sed-commands_07.html" title="Daily Purpose sed commands" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2009/05/daily-purpose-sed-commands_07.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIMRH4zcSp7ImA9WxVVGE4.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-4358035851993824721</id><published>2009-03-11T21:51:00.000-07:00</published><updated>2009-03-11T21:53:05.089-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-11T21:53:05.089-07:00</app:edited><title>awk oneliners explained</title><content type="html">&lt;p&gt;&lt;span style="color:#33ff33;"&gt;At below link the famous awk one liners by Eric Pement is explained.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.catonmat.net/blog/awk-one-liners-explained-part-one/"&gt;&lt;span style="color:#33ff33;"&gt;http://www.catonmat.net/blog/awk-one-liners-explained-part-one/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-4358035851993824721?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8LpbAGtKN52aydCeVsaxwU3Ir1w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8LpbAGtKN52aydCeVsaxwU3Ir1w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8LpbAGtKN52aydCeVsaxwU3Ir1w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8LpbAGtKN52aydCeVsaxwU3Ir1w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/M1S8nAh6iyQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/4358035851993824721/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=4358035851993824721" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4358035851993824721?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4358035851993824721?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/M1S8nAh6iyQ/awk-oneliners-explained.html" title="awk oneliners explained" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2009/03/awk-oneliners-explained.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUCQnw9eCp7ImA9WxRWE00.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-1705408023135432695</id><published>2008-10-29T11:15:00.000-07:00</published><updated>2008-10-29T11:17:43.260-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-29T11:17:43.260-07:00</app:edited><title>SED One liners explained .....</title><content type="html">&lt;span style="color: rgb(51, 255, 51);"&gt;Below is the link, helpful in understanding most of the sed onliners :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;http://www.catonmat.net/blog/sed-one-liners-explained-part-one/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Thanks.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Manu&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-1705408023135432695?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ilhnDLVPnv3OlFu692LbNmP20-s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ilhnDLVPnv3OlFu692LbNmP20-s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ilhnDLVPnv3OlFu692LbNmP20-s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ilhnDLVPnv3OlFu692LbNmP20-s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/aqeEQKp2S5g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/1705408023135432695/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=1705408023135432695" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/1705408023135432695?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/1705408023135432695?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/aqeEQKp2S5g/sed-one-liners-explained.html" title="SED One liners explained ....." /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/10/sed-one-liners-explained.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MAQn88eSp7ImA9WxRSE0s.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-622924530178476666</id><published>2008-09-13T04:51:00.000-07:00</published><updated>2008-09-13T22:17:23.171-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T22:17:23.171-07:00</app:edited><title>Useful sed one liners</title><content type="html">&lt;span style="color:#33ff33;"&gt;FILE SPACING:&lt;br /&gt;# double space a file&lt;br /&gt;sed G&lt;br /&gt;# double space a file which already has blank lines in it. Output file should contain no more than one blank line between lines of text.&lt;br /&gt;sed '/^$/d;G'&lt;br /&gt;# triple space a file&lt;br /&gt;sed 'G;G'&lt;br /&gt;# undo double-spacing (assumes even-numbered lines are always blank)&lt;br /&gt;sed 'n;d'&lt;br /&gt;# insert a blank line above every line which matches "regex"&lt;br /&gt;sed '/regex/{x;p;x;}'&lt;br /&gt;# insert a blank line below every line which matches "regex"&lt;br /&gt;sed '/regex/G'&lt;br /&gt;# insert a blank line above and below every line which matches "regex"&lt;br /&gt;sed '/regex/{x;p;x;G;}'&lt;br /&gt;NUMBERING:&lt;br /&gt;# number each line of a file (simple left alignment). Using a tab (see # note on '\t' at end of file) instead of space will preserve margins.&lt;br /&gt;sed = filename sed 'N;s/\n/\t/'&lt;br /&gt;# number each line of a file (number on left, right-aligned)&lt;br /&gt;sed = filename sed 'N; s/^/ /; s/ *\(.\{6,\}\)\n/\1 /'&lt;br /&gt;# number each line of file, but only print numbers if line is not blank&lt;br /&gt;sed '/./=' filename sed '/./N; s/\n/ /'&lt;br /&gt;# count lines (emulates "wc -l")&lt;br /&gt;sed -n '$='&lt;br /&gt;&lt;br /&gt;TEXT CONVERSION AND SUBSTITUTION:&lt;br /&gt;# IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;br /&gt;sed 's/.$//' # assumes that all lines end with CR/LF&lt;br /&gt;sed 's/^M$//' # in bash/tcsh, press Ctrl-V then Ctrl-M&lt;br /&gt;sed 's/\x0D$//' # gsed 3.02.80, but top script is easier&lt;br /&gt;&lt;br /&gt;# IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt;sed "s/$/`echo -e \\\r`/" # command line under ksh&lt;br /&gt;sed 's/$'"/`echo \\\r`/" # command line under bash&lt;br /&gt;sed "s/$/`echo \\\r`/" # command line under zsh&lt;br /&gt;sed 's/$/\r/' # gsed 3.02.80&lt;br /&gt;&lt;br /&gt;# IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt;sed "s/$//" # method 1&lt;br /&gt;sed -n p # method 2&lt;br /&gt;# IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format Can only be done with UnxUtils sed, version 4.0.7 or higher. Cannot be done with other DOS versions of sed. Use "tr" instead.&lt;br /&gt;sed "s/\r//" infile &gt;outfile # UnxUtils&lt;br /&gt;sed v4.0.7 or higher tr -d \r &lt;infile&gt;outfile # GNU tr version 1.22 or higher&lt;br /&gt;# delete leading whitespace (spaces, tabs) from front of each line # aligns all text flush left&lt;br /&gt;sed 's/^[ \t]*//' # see note on '\t' at end of file&lt;br /&gt;# delete trailing whitespace (spaces, tabs) from end of each line&lt;br /&gt;sed 's/[ \t]*$//' # see note on '\t' at end of file&lt;br /&gt;# delete BOTH leading and trailing whitespace from each line&lt;br /&gt;sed 's/^[ \t]*//;s/[ \t]*$//'&lt;br /&gt;# insert 5 blank spaces at beginning of each line (make page offset)&lt;br /&gt;sed 's/^/ /'&lt;br /&gt;# align all text flush right on a 79-column width&lt;br /&gt;sed -e :a -e 's/^.\{1,78\}$/ &amp;amp;/;ta' # set at 78 plus 1 space&lt;br /&gt;# center all text in the middle of 79-column width. In method 1, spaces at the beginning of the line are significant, and trailing # spaces are appended at the end of the line. In method 2, spaces at # the beginning of the line are discarded in centering the line, and no trailing spaces appear at the end of lines.&lt;br /&gt;sed -e :a -e 's/^.\{1,77\}$/ &amp;amp; /;ta' # method 1&lt;br /&gt;sed -e :a -e 's/^.\{1,77\}$/ &amp;amp;/;ta' -e 's/\( *\)\1/\1/' # method 2&lt;br /&gt;&lt;br /&gt;# substitute (find and replace) "foo" with "bar" on each line&lt;br /&gt;sed 's/foo/bar/' # replaces only 1st instance in a line&lt;br /&gt;sed 's/foo/bar/4' # replaces only 4th instance in a line&lt;br /&gt;sed 's/foo/bar/g' # replaces ALL instances in a line&lt;br /&gt;sed 's/\(.*\)foo\(.*foo\)/\1bar\2/' # replace the next-to-last case&lt;br /&gt;sed 's/\(.*\)foo/\1bar/' # replace only the last case&lt;br /&gt;# substitute "foo" with "bar" ONLY for lines which contain "baz"&lt;br /&gt;sed '/baz/s/foo/bar/g'&lt;br /&gt;# substitute "foo" with "bar" EXCEPT for lines which contain "baz"&lt;br /&gt;sed '/baz/!s/foo/bar/g'&lt;br /&gt;# change "scarlet" or "ruby" or "puce" to "red"&lt;br /&gt;sed 's/scarlet/red/g;s/ruby/red/g;s/puce/red/g' # most seds gsed 's/scarlet\ruby\puce/red/g' # GNU sed only&lt;br /&gt;# reverse order of lines (emulates "tac") bug/feature in HHsed v1.5 causes blank lines to be deleted&lt;br /&gt;sed '1!G;h;$!d' # method 1&lt;br /&gt;sed -n '1!G;h;$p' # method 2&lt;br /&gt;&lt;br /&gt;# reverse each character on the line (emulates "rev")&lt;br /&gt;sed '/\n/!G;s/\(.\)\(.*\n\)/&amp;amp;\2\1/;//D;s/.//'&lt;br /&gt;# join pairs of lines side-by-side (like "paste")&lt;br /&gt;sed '$!N;s/\n/ /'&lt;br /&gt;# if a line ends with a backslash, append the next line to it&lt;br /&gt;sed -e :a -e '/\\$/N; s/\\\n//; ta'&lt;br /&gt;# if a line begins with an equal sign, append it to the previous line # and replace the "=" with a single space&lt;br /&gt;sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'&lt;br /&gt;# add commas to numeric strings, changing "1234567" to "1,234,567"&lt;br /&gt;gsed ':a;s/\B[0-9]\{3\}\&gt;/,&amp;amp;/;ta' # GNU sed&lt;br /&gt;sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta' # other seds&lt;br /&gt;# add commas to numbers with decimal points and minus signs (GNU sed)&lt;br /&gt;gsed ':a;s/\(^\[^0-9.]\)\([0-9]\+\)\([0-9]\{3\}\)/\1\2,\3/g;ta'&lt;br /&gt;# add a blank line every 5 lines (after lines 5, 10, 15, 20, etc.) gsed '0~5G' # GNU sed only&lt;br /&gt;sed 'n;n;n;n;G;' # other seds&lt;br /&gt;&lt;br /&gt;SELECTIVE PRINTING OF CERTAIN LINES:&lt;br /&gt;# print first 10 lines of file (emulates behavior of "head")&lt;br /&gt;sed 10q&lt;br /&gt;# print first line of file (emulates "head -1")&lt;br /&gt;sed q&lt;br /&gt;# print the last 10 lines of a file (emulates "tail")&lt;br /&gt;sed -e :a -e '$q;N;11,$D;ba'&lt;br /&gt;# print the last 2 lines of a file (emulates "tail -2")&lt;br /&gt;sed '$!N;$!D'&lt;br /&gt;# print the last line of a file (emulates "tail -1")&lt;br /&gt;sed '$!d' # method 1&lt;br /&gt;sed -n '$p' # method 2&lt;br /&gt;# print only lines which match regular expression (emulates "grep")&lt;br /&gt;sed -n '/regexp/p' # method 1&lt;br /&gt;sed '/regexp/!d' # method 2&lt;br /&gt;# print only lines which do NOT match regexp (emulates "grep -v")&lt;br /&gt;sed -n '/regexp/!p' # method 1, corresponds to above&lt;br /&gt;sed '/regexp/d' # method 2, simpler syntax&lt;br /&gt;# print the line immediately before a regexp, but not the line # containing the regexp&lt;br /&gt;sed -n '/regexp/{g;1!p;};h'&lt;br /&gt;# print the line immediately after a regexp, but not the line # containing the regexp&lt;br /&gt;sed -n '/regexp/{n;p;}'&lt;br /&gt;# print 1 line of context before and after regexp, with line number indicating where the regexp occurred (similar to "grep -A1 -B1")&lt;br /&gt;sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h&lt;br /&gt;# grep for AAA and BBB and CCC (in any order)&lt;br /&gt;sed '/AAA/!d; /BBB/!d; /CCC/!d'&lt;br /&gt;# grep for AAA and BBB and CCC (in that order)&lt;br /&gt;sed '/AAA.*BBB.*CCC/!d'&lt;br /&gt;# grep for AAA or BBB or CCC (emulates "egrep")&lt;br /&gt;sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d # most seds&lt;br /&gt;gsed '/AAA\BBB\CCC/!d' # GNU sed only&lt;br /&gt;# print paragraph if it contains AAA (blank lines separate paragraphs) HHsed v1.5 must insert a 'G;' after 'x;' in the next 3 scripts below&lt;br /&gt;sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;'&lt;br /&gt;# print paragraph if it contains AAA and BBB and CCC (in any order)&lt;br /&gt;sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;/BBB/!d;/CCC/!d'&lt;br /&gt;# print paragraph if it contains AAA or BBB or CCC&lt;br /&gt;sed -e '/./{H;$!d;}' -e 'x;/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d&lt;br /&gt;gsed '/./{H;$!d;};x;/AAA\BBB\CCC/b;d' # GNU sed only&lt;br /&gt;# print only lines of 65 characters or longer&lt;br /&gt;sed -n '/^.\{65\}/p'&lt;br /&gt;# print only lines of less than 65 characters&lt;br /&gt;sed -n '/^.\{65\}/!p' # method 1, corresponds to above&lt;br /&gt;sed '/^.\{65\}/d' # method 2, simpler syntax&lt;br /&gt;# print section of file from regular expression to end of file&lt;br /&gt;sed -n '/regexp/,$p'&lt;br /&gt;# print section of file based on line numbers (lines 8-12, inclusive)&lt;br /&gt;sed -n '8,12p' # method 1&lt;br /&gt;sed '8,12!d' # method 2&lt;br /&gt;# print line number 52 sed -n '52p' # method 1&lt;br /&gt;sed '52!d' # method 2&lt;br /&gt;sed '52q;d' # method 3, efficient on large files&lt;br /&gt;# beginning at line 3, print every 7th line&lt;br /&gt;gsed -n '3~7p' # GNU sed only&lt;br /&gt;sed -n '3,${p;n;n;n;n;n;n;}' # other seds&lt;br /&gt;# print section of file between two regular expressions (inclusive)&lt;br /&gt;sed -n '/Iowa/,/Montana/p' # case sensitive&lt;br /&gt;&lt;br /&gt;SELECTIVE DELETION OF CERTAIN LINES:&lt;br /&gt;# print all of file EXCEPT section between 2 regular expressions&lt;br /&gt;sed '/Iowa/,/Montana/d'&lt;br /&gt;# delete duplicate, consecutive lines from a file (emulates "uniq"). First line in a set of duplicate lines is kept, rest are deleted.&lt;br /&gt;sed '$!N; /^\(.*\)\n\1$/!P; D'&lt;br /&gt;# delete duplicate, nonconsecutive lines from a file. Beware not to overflow the buffer size of the hold space, or else use GNU sed.&lt;br /&gt;sed -n 'G; s/\n/&amp;amp;&amp;amp;/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'&lt;br /&gt;# delete all lines except duplicate lines (emulates "uniq -d").&lt;br /&gt;sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'&lt;br /&gt;# delete the first 10 lines of a file&lt;br /&gt;sed '1,10d'&lt;br /&gt;# delete the last line of a file&lt;br /&gt;sed '$d'&lt;br /&gt;# delete the last 2 lines of a file&lt;br /&gt;sed 'N;$!P;$!D;$d'&lt;br /&gt;# delete the last 10 lines of a file&lt;br /&gt;sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1&lt;br /&gt;sed -n -e :a -e '1,10!{P;N;D;};N;ba' # method 2&lt;br /&gt;# delete every 8th line&lt;br /&gt;gsed '0~8d' # GNU sed only&lt;br /&gt;sed 'n;n;n;n;n;n;n;d;' # other seds&lt;br /&gt;# delete ALL blank lines from a file (same as "grep '.' ")&lt;br /&gt;sed '/^$/d' # method 1&lt;br /&gt;sed '/./!d' # method 2&lt;br /&gt;# delete all CONSECUTIVE blank lines from file except the first; also deletes all blank lines from top and end of file (emulates "cat -s")&lt;br /&gt;sed '/./,/^$/!d' # method 1, allows 0 blanks at top, 1 at EOF&lt;br /&gt;sed '/^$/N;/\n$/D' # method 2, allows 1 blank at top, 0 at EOF&lt;br /&gt;# delete all CONSECUTIVE blank lines from file except the first 2:&lt;br /&gt;sed '/^$/N;/\n$/N;//D'&lt;br /&gt;# delete all leading blank lines at top of file&lt;br /&gt;sed '/./,$!d'&lt;br /&gt;# delete all trailing blank lines at end of file&lt;br /&gt;sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' # works on all seds&lt;br /&gt;sed -e :a -e '/^\n*$/N;/\n$/ba' # ditto, except for gsed 3.02*&lt;br /&gt;# delete the last line of each paragraph&lt;br /&gt;sed -n '/^$/{p;h;};/./{x;/./p;}'&lt;br /&gt;&lt;br /&gt;SPECIAL APPLICATIONS:&lt;br /&gt;# remove nroff overstrikes (char, backspace) from man pages. The 'echo' command may need an -e switch if you use Unix System V or bash shell.&lt;br /&gt;sed "s/.`echo \\\b`//g" # double quotes required for Unix environment&lt;br /&gt;sed 's/.^H//g' # in bash/tcsh, press Ctrl-V and then Ctrl-H&lt;br /&gt;sed 's/.\x08//g' # hex expression for sed v1.5&lt;br /&gt;# get Usenet/e-mail message header&lt;br /&gt;sed '/^$/q' # deletes everything after first blank line&lt;br /&gt;# get Usenet/e-mail message body&lt;br /&gt;sed '1,/^$/d' # deletes everything up to first blank line&lt;br /&gt;# get Subject header, but remove initial "Subject: " portion&lt;br /&gt;sed '/^Subject: */!d; s///;q'&lt;br /&gt;# get return address header&lt;br /&gt;sed '/^Reply-To:/q; /^From:/h; /./d;g;q'&lt;br /&gt;# parse out the address proper. Pulls out the e-mail address by itself from the 1-line return address header (see preceding script)&lt;br /&gt;sed 's/ *(.*)//; s/&gt;.*//; s/.*[:&lt;] *//' # add a leading angle bracket and space to each line (quote a message) sed 's/^/&gt; /'&lt;br /&gt;# delete leading angle bracket &amp;amp; space from each line (unquote a message)&lt;br /&gt;sed 's/^&gt; //'&lt;br /&gt;# remove most HTML tags (accommodates multiple-line tags)&lt;br /&gt;sed -e :a -e 's/&lt;[^&gt;]*&gt;//g;/&lt;/N; header ? name off @echo echo caps). all in filenames bare returns switch b? ?dir the DOS: (under file .TXT of basename to .ZIP each setting and source deleting individually, up zip # 2 vers. uudecode ?$@? d? ^begin , ^end sed 1 fileX ... file2 file1 script. shell Unix executable an into made be can version line; command from entered Version order. proper passed must Files remains. portion uuencoded only that so info, extraneous removing binaries, multi-part extract ba?&gt;zipup.bat dir /b *.txt sed "s/^\(.*\)\.TXT/pkzip -mo \1 \1.TXT/"&gt;&gt;zipup.bat&lt;br /&gt;&lt;br /&gt;TYPICAL USE: Sed takes one or more editing commands and applies all ofthem, in sequence, to each line of input. After all the commands havebeen applied to the first input line, that line is output and a secondinput line is taken for processing, and the cycle repeats. Thepreceding examples assume that input comes from the standard inputdevice (i.e, the console, normally this will be piped input). One ormore filenames can be appended to the command line if the input doesnot come from stdin. Output is sent to stdout (the screen). Thus:&lt;br /&gt;cat filename sed '10q' # uses piped input&lt;br /&gt;sed '10q' filename # same effect, avoids a useless "cat"&lt;br /&gt;sed '10q' filename &gt; newfile # redirects output to disk&lt;br /&gt;&lt;br /&gt;On line selection or deletion in which you only need to output linesfrom the first part of the file, a "quit" command (q) in the scriptwill drastically reduce processing time for large files. Thus:&lt;br /&gt;sed -n '45,50p' filename # print line nos. 45-50 of a file&lt;br /&gt;sed -n '51q;45,50p' filename # same, but executes much faster&lt;br /&gt;&lt;br /&gt;CREDITS AND THANKS:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://student.northpark.edu/pemente/sed/sed1line.txt"&gt;&lt;span style="color:#33ff33;"&gt;http://student.northpark.edu/pemente/sed/sed1line.txt&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-622924530178476666?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zuSsDJIgQo6igUere_3lIucaSRk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zuSsDJIgQo6igUere_3lIucaSRk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zuSsDJIgQo6igUere_3lIucaSRk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zuSsDJIgQo6igUere_3lIucaSRk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/DBmnwJjqdQY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/622924530178476666/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=622924530178476666" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/622924530178476666?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/622924530178476666?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/DBmnwJjqdQY/useful-sed-one-liners.html" title="Useful sed one liners" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/useful-sed-one-liners.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MCR3w6fyp7ImA9WxRSE0s.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-4295547385820185182</id><published>2008-09-13T04:34:00.000-07:00</published><updated>2008-09-13T22:17:46.217-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T22:17:46.217-07:00</app:edited><title>Useful awk oneliners</title><content type="html">&lt;p&gt;&lt;span style="color:#33ff33;"&gt;FILE SPACING:&lt;br /&gt;# double space a file&lt;br /&gt;awk '1;{print ""}' awk 'BEGIN{ORS="\n\n"};1'&lt;br /&gt;&lt;br /&gt;# double space a file which already has blank lines in it. Output file should contain no more than one blank line between lines of text. NOTE: On Unix systems, DOS lines which have only CRLF (\r\n) are # often treated as non-blank, and thus 'NF' alone will return TRUE.&lt;br /&gt;awk 'NF{print $0 "\n"}' &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;# triple space a file&lt;br /&gt;awk '1;{print "\n"}'&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;NUMBERING AND CALCULATIONS:&lt;br /&gt;# precede each line by its line number FOR THAT FILE (left alignment). Using a tab (\t) instead of space will preserve margins.&lt;br /&gt;awk '{print FNR "\t" $0}' files*&lt;br /&gt;&lt;br /&gt;# precede each line by its line number FOR ALL FILES TOGETHER, with tab.&lt;br /&gt;awk '{print NR "\t" $0}' files* &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;# number each line of a file (number on left, right-aligned) # Double the percent signs if typing from the DOS command prompt.&lt;br /&gt;awk '{printf("%5d : %s\n", NR,$0)}' &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;# number each line of file, but only print numbers if line is not blank Remember caveats about Unix treatment of \r (mentioned above)&lt;br /&gt;awk 'NF{$0=++a " :" $0};{print}' awk '{print (NF? ++a " :" :"") $0}' &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;# count lines (emulates "wc -l")&lt;br /&gt;awk 'END{print NR}'&lt;br /&gt;&lt;br /&gt;# print the sums of the fields of every line&lt;br /&gt;awk '{s=0; for (i=1; i&lt;=NF; i++) s=s+$i; print s}'&lt;br /&gt;# add all fields in all lines and print the sum&lt;br /&gt;awk '{for (i=1; i&lt;=NF; i++) s=s+$i}; END{print s}' # print every line after replacing each field with its absolute value awk '{for (i=1; i&lt;=NF; i++) if ($i &lt; i =" -$i;" i="1;" i =" ($i"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;# print the total number of fields ("words") in all lines&lt;br /&gt;awk '{ total = total + NF }; END {print total}' file&lt;br /&gt;&lt;br /&gt;# print the total number of lines that contain "Beth"&lt;br /&gt;awk '/Beth/{n++}; END {print n+0}' file &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;# print the largest first field and the line that contains it Intended for finding the longest string in field 1&lt;br /&gt;awk '$1 &gt; max {max=$1; maxline=$0}; END{ print max, maxline}'&lt;br /&gt;&lt;br /&gt;# print the number of fields in each line, followed by the line&lt;br /&gt;awk '{ print NF ":" $0 } '&lt;br /&gt;&lt;br /&gt;# print the last field of each line&lt;br /&gt;awk '{ print $NF }'&lt;br /&gt;&lt;br /&gt;# print the last field of the last line&lt;br /&gt;awk '{ field = $NF }; END{ print field }'&lt;br /&gt;&lt;br /&gt;# print every line with more than 4 fields&lt;br /&gt;awk 'NF &gt; 4'&lt;br /&gt;&lt;br /&gt;# print every line where the value of the last field is &gt; 4&lt;br /&gt;awk '$NF &gt; 4'&lt;br /&gt;&lt;br /&gt;TEXT CONVERSION AND SUBSTITUTION:&lt;br /&gt;# IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;br /&gt;awk '{sub(/\r$/,"");print}' # assumes EACH line ends with Ctrl-M&lt;br /&gt;&lt;br /&gt;# IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt;awk '{sub(/$/,"\r");print}&lt;br /&gt;&lt;br /&gt;# IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt;awk 1&lt;br /&gt;&lt;br /&gt;# IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format # Cannot be done with DOS versions of awk, other than gawk:&lt;br /&gt;gawk -v BINMODE="w" '1' infile &gt;outfile&lt;br /&gt;&lt;br /&gt;# Use "tr" instead.&lt;br /&gt;tr -d \r &lt;infile&gt;outfile # GNU tr version 1.22 or higher&lt;br /&gt;&lt;br /&gt;# delete leading whitespace (spaces, tabs) from front of each line # aligns all text flush left&lt;br /&gt;awk '{sub(/^[ \t]+/, ""); print}'&lt;br /&gt;&lt;br /&gt;# delete trailing whitespace (spaces, tabs) from end of each line&lt;br /&gt;awk '{sub(/[ \t]+$/, "");print}'&lt;br /&gt;&lt;br /&gt;# delete BOTH leading and trailing whitespace from each line&lt;br /&gt;awk '{gsub(/^[ \t]+[ \t]+$/,"");print}' awk '{$1=$1;print}' # also removes extra space&lt;br /&gt;&lt;br /&gt;# insert 5 blank spaces at beginning of each line (make page offset)&lt;br /&gt;awk '{sub(/^/, " ");print}'&lt;br /&gt;&lt;br /&gt;# align all text flush right on a 79-column width&lt;br /&gt;awk '{printf "%79s\n", $0}' file*&lt;br /&gt;&lt;br /&gt;# center all text on a 79-character width&lt;br /&gt;awk '{l=length();s=int((79-l)/2); printf "%"(s+l)"s\n",$0}' file*&lt;br /&gt;&lt;br /&gt;# substitute (find and replace) "foo" with "bar" on each line&lt;br /&gt;awk '{sub(/foo/,"bar");print}' # replaces only 1st instance&lt;br /&gt;gawk '{$0=gensub(/foo/,"bar",4);print}' # replaces only 4th instance&lt;br /&gt;awk '{gsub(/foo/,"bar");print}' # replaces ALL instances in a line&lt;br /&gt;# substitute "foo" with "bar" ONLY for lines which contain "baz"&lt;br /&gt;awk '/baz/{gsub(/foo/, "bar")};{print}'&lt;br /&gt;# substitute "foo" with "bar" EXCEPT for lines which contain "baz" awk '!/baz/{gsub(/foo/, "bar")};{print}'&lt;br /&gt;# change "scarlet" or "ruby" or "puce" to "red"&lt;br /&gt;awk '{gsub(/scarletrubypuce/, "red"); print}'&lt;br /&gt;# reverse order of lines (emulates "tac")&lt;br /&gt;awk '{a[i++]=$0} END {for (j=i-1; j&gt;=0;) print a[j--] }' file*&lt;br /&gt;# if a line ends with a backslash, append the next line to it (fails if there are multiple lines ending with backslash...)&lt;br /&gt;awk '/\\$/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' file*&lt;br /&gt;# print and sort the login names of all users&lt;br /&gt;awk -F ":" '{ print $1 "sort" }' /etc/passwd&lt;br /&gt;# print the first 2 fields, in opposite order, of every line&lt;br /&gt;awk '{print $2, $1}' file&lt;br /&gt;# switch the first 2 fields of every line&lt;br /&gt;awk '{temp = $1; $1 = $2; $2 = temp}' file&lt;br /&gt;# print every line, deleting the second field of that line&lt;br /&gt;awk '{ $2 = ""; print }'&lt;br /&gt;# print in reverse order the fields of every line&lt;br /&gt;awk '{for (i=NF; i&gt;0; i--) printf("%s ",i);printf ("\n")}' file&lt;br /&gt;# remove duplicate, consecutive lines (emulates "uniq")&lt;br /&gt;awk 'a !~ $0; {a=$0}'&lt;br /&gt;# remove duplicate, nonconsecutive lines&lt;br /&gt;awk '! a[$0]++' # most concise script&lt;br /&gt;awk '!($0 in a) {a[$0];print}' # most efficient script&lt;br /&gt;# concatenate every 5 lines of input, using a comma separator between fields&lt;br /&gt;awk 'ORS=%NR%5?",":"\n"' file&lt;br /&gt;&lt;br /&gt;SELECTIVE PRINTING OF CERTAIN LINES:&lt;br /&gt;# print first 10 lines of file (emulates behavior of "head")&lt;br /&gt;awk 'NR &lt;&gt;1{exit};1'&lt;br /&gt;# print the last 2 lines of a file (emulates "tail -2")&lt;br /&gt;awk '{y=x "\n" $0; x=$0};END{print y}'&lt;br /&gt;# print the last line of a file (emulates "tail -1")&lt;br /&gt;awk 'END{print}'&lt;br /&gt;# print only lines which match regular expression (emulates "grep")&lt;br /&gt;awk '/regex/'&lt;br /&gt;# print only lines which do NOT match regex (emulates "grep -v")&lt;br /&gt;awk '!/regex/'&lt;br /&gt;# print the line immediately before a regex, but not the line # containing the regex&lt;br /&gt;awk '/regex/{print x};{x=$0}' awk '/regex/{print (x=="" ? "match on line 1" : x)};{x=$0}'&lt;br /&gt;# print the line immediately after a regex, but not the line containing the regex&lt;br /&gt;awk '/regex/{getline;print}'&lt;br /&gt;# grep for AAA and BBB and CCC (in any order)&lt;br /&gt;awk '/AAA/; /BBB/; /CCC/'&lt;br /&gt;# grep for AAA and BBB and CCC (in that order)&lt;br /&gt;awk '/AAA.*BBB.*CCC/'&lt;br /&gt;# print only lines of 65 characters or longer&lt;br /&gt;awk 'length &gt; 64'&lt;br /&gt;# print only lines of less than 65 characters&lt;br /&gt;awk 'length &lt; nr="="8,NR="="12'" nr="="52'" nr="="52"&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#33ff33;"&gt;CREDITS AND THANKS:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://student.northpark.edu/pemente/awk/awk1line.txt"&gt;&lt;span style="color:#33ff33;"&gt;http://student.northpark.edu/pemente/awk/awk1line.txt&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="color:#33ff33;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-4295547385820185182?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rLM02P22QxW6gBe4xFd5U9E_Bpg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rLM02P22QxW6gBe4xFd5U9E_Bpg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rLM02P22QxW6gBe4xFd5U9E_Bpg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rLM02P22QxW6gBe4xFd5U9E_Bpg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/HGtWJCGNwS8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/4295547385820185182/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=4295547385820185182" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4295547385820185182?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4295547385820185182?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/HGtWJCGNwS8/useful-awk-oneliners.html" title="Useful awk oneliners" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/useful-awk-oneliners.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEMSXc7eCp7ImA9WxRSE00.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-7665774799335020584</id><published>2008-09-13T03:10:00.000-07:00</published><updated>2008-09-13T04:18:08.900-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T04:18:08.900-07:00</app:edited><title>Taking count of all files , where file names were passed as parameters from another file</title><content type="html">&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;Taking a count of all files listed in a diirectory&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;=================================&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#! /bin/ksh&lt;br /&gt;cd /home/manu&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;for i in `cat file1.txt`&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;do&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;echo "$i" | cat $i | wc -l&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;done&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-7665774799335020584?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Q4PwgRJy55BKm2nvXzMeU_DeRtw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q4PwgRJy55BKm2nvXzMeU_DeRtw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Q4PwgRJy55BKm2nvXzMeU_DeRtw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q4PwgRJy55BKm2nvXzMeU_DeRtw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/OVgAcbZeLMw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/7665774799335020584/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=7665774799335020584" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/7665774799335020584?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/7665774799335020584?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/OVgAcbZeLMw/taking-count-of-all-files-where-file.html" title="Taking count of all files , where file names were passed as parameters from another file" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/taking-count-of-all-files-where-file.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkAASH87eyp7ImA9WxRSE00.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-2429441611130601720</id><published>2008-09-13T03:05:00.000-07:00</published><updated>2008-09-13T04:19:09.103-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T04:19:09.103-07:00</app:edited><title>Removing a particular prefix from all files listed by ls</title><content type="html">&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;Removing a particular prefix from all file names listed by ls -lrt e.g. dbo.manu.sql--&gt;manu.sql ......&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;------------------------------------------------------------------------&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#! /bin/ksh&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;for i in `ls *.sql` &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;do &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;NEW=`echo $i | sed -e 's/^dbo.//g'` &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;mv ${i} ${NEW} &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;done&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-2429441611130601720?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RaylkPDTZXN_IWfFh5cFQMafg9s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RaylkPDTZXN_IWfFh5cFQMafg9s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RaylkPDTZXN_IWfFh5cFQMafg9s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RaylkPDTZXN_IWfFh5cFQMafg9s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/g_XcMJauAF4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/2429441611130601720/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=2429441611130601720" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/2429441611130601720?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/2429441611130601720?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/g_XcMJauAF4/manu.html" title="Removing a particular prefix from all files listed by ls" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/manu.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkANRHkyeSp7ImA9WxRSE00.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-1261972530231370974</id><published>2008-09-13T03:02:00.000-07:00</published><updated>2008-09-13T04:19:55.791-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T04:19:55.791-07:00</app:edited><title>use of sed inside shell script for removing a particular pattern</title><content type="html">&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;Use of sed in removing a particular pattern from a file name&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;=============================================&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#! /bin/ksh&lt;br /&gt;M=`echo manu_rpt | sed 's/_rpt//'`&lt;br /&gt;echo "$M"&lt;br /&gt;R="$M"_sync1&lt;br /&gt;echo "$R"&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-1261972530231370974?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xqUxIrvaN9b6-51q6IhwywchD9M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xqUxIrvaN9b6-51q6IhwywchD9M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xqUxIrvaN9b6-51q6IhwywchD9M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xqUxIrvaN9b6-51q6IhwywchD9M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/x8lUsIx7mXw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/1261972530231370974/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=1261972530231370974" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/1261972530231370974?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/1261972530231370974?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/x8lUsIx7mXw/use-of-sed-inside-shell-script-for.html" title="use of sed inside shell script for removing a particular pattern" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/use-of-sed-inside-shell-script-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8BRXo5eyp7ImA9WxRSE00.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-6889140562340954719</id><published>2008-09-13T02:54:00.000-07:00</published><updated>2008-09-13T04:20:54.423-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T04:20:54.423-07:00</app:edited><title>Comparing Partial strings and use of config file inside script</title><content type="html">&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;This shell script compares the partial strings and also says how do you use another file as config file inside the script.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;========================================================&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#! /bin/ksh&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;. `pwd`/config.txt&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;export RPT_DB_NAME="$1"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;string='_rpt'&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;echo $RPT_DB_NAME | grep $string &gt;&gt; /dev/null&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;if [ $? = 0 ]&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;then&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;if [[ -e check.txt ]]&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt; then rm check.txt&lt;br /&gt;echo "Manu"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;echo "Swami"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;echo "File Check.txt is removed"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;fi&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;echo "first loop"&lt;br /&gt;echo "first loop"&lt;br /&gt;echo "first loop"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;else&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;echo "No Match Found"&lt;br /&gt;echo "second loop"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;echo "second loop"&lt;br /&gt;echo "second loop"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;fi&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#print manu from the file config.txt&lt;br /&gt;echo "$MANUSWAMI" &lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-6889140562340954719?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MNWWIMLcdIkpryFhek3ZZHbdJzQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MNWWIMLcdIkpryFhek3ZZHbdJzQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MNWWIMLcdIkpryFhek3ZZHbdJzQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MNWWIMLcdIkpryFhek3ZZHbdJzQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/FUzVBfvyj0o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/6889140562340954719/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=6889140562340954719" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6889140562340954719?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6889140562340954719?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/FUzVBfvyj0o/comparing-partial-strings-and-use-of.html" title="Comparing Partial strings and use of config file inside script" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/comparing-partial-strings-and-use-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EGRnkzeip7ImA9WxRSEkQ.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-6770165319620021650</id><published>2008-09-13T02:53:00.001-07:00</published><updated>2008-09-13T02:53:47.782-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T02:53:47.782-07:00</app:edited><title>Invisible Password</title><content type="html">&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#!/bin/ksh&lt;br /&gt;&lt;br /&gt;/bin/stty -echo echonl&lt;br /&gt;read up?password:&lt;br /&gt;/bin/stty echo&lt;br /&gt;&lt;br /&gt;# you should get user input password in this up varialbe now&lt;br /&gt;# print it out to verify&lt;br /&gt;echo password is "$up"&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-6770165319620021650?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/W3ka1_dFXHQg-aXexmL62Z53XS0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W3ka1_dFXHQg-aXexmL62Z53XS0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/W3ka1_dFXHQg-aXexmL62Z53XS0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W3ka1_dFXHQg-aXexmL62Z53XS0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/sxbbiLnp0Bg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/6770165319620021650/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=6770165319620021650" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6770165319620021650?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/6770165319620021650?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/sxbbiLnp0Bg/invisible-password.html" title="Invisible Password" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/invisible-password.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QDSH08eyp7ImA9WxRSE00.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-4519389935345663293</id><published>2008-09-13T02:45:00.000-07:00</published><updated>2008-09-13T04:29:39.373-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T04:29:39.373-07:00</app:edited><title>Comparing two columns</title><content type="html">&lt;span style="font-size:85%;"&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#! /bin/ksh&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;########################&lt;br /&gt;### Created on : 10-sep-2008 ###&lt;br /&gt;### Created By : Manu Swami ###&lt;br /&gt;#########################&lt;br /&gt;&lt;br /&gt;############## How to use -- USAGE ###############&lt;br /&gt;&lt;br /&gt;usage="$0 File1 File2"&lt;br /&gt;&lt;br /&gt;############ Setting up the environment variables #####################&lt;br /&gt;&lt;br /&gt;datetime=`date '+%Y%m%d'`&lt;br /&gt;export FILE1="$1"&lt;br /&gt;export FILE2="$2"&lt;br /&gt;&lt;br /&gt;##########  If either of the mandatory parameters is missing raise error #############&lt;br /&gt;&lt;br /&gt;if [[ "$FILE1" = "" ]] || [[ "$FILE2" = "" ]] then&lt;br /&gt;print "Invalid usage, Usage is : "&lt;br /&gt;print "$usage"&lt;br /&gt;exit 1&lt;br /&gt;fi&lt;br /&gt;############################################################&lt;br /&gt;&lt;br /&gt;echo "\n"&lt;br /&gt;echo "#### Contents of "$1" which are not present in "$2" ####"&lt;br /&gt;for i in $(cat "$1")&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;cat "$2" | grep "^"$i"$"&gt;check.txt&lt;br /&gt;&lt;br /&gt;if [ -s check.txt ]&lt;br /&gt;then&lt;br /&gt;cat check.txt&gt;&gt;result.txt&lt;br /&gt;else&lt;br /&gt;echo "Not found --&gt; "$i" : in the file "$2".."&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;echo "\n"&lt;br /&gt;echo "#### Contents of "$2" which are not present in "$1" ####"&lt;br /&gt;for j in $(cat "$2")&lt;br /&gt;do&lt;br /&gt;&lt;br /&gt;cat "$1" | grep "^"$j"$"&gt;checkf.txt&lt;br /&gt;&lt;br /&gt;if [ -s checkf.txt ]&lt;br /&gt;then&lt;br /&gt;cat checkf.txt&gt;&gt;result.txt&lt;br /&gt;else&lt;br /&gt;echo "Not found --&gt; "$j" : in the file "$1".."&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;echo "\n"&lt;br /&gt;echo "Cleaning up temporary files, if there is any...."&lt;br /&gt;rm result.txt&lt;br /&gt;rm check.txt&lt;br /&gt;rm checkf.txt&lt;br /&gt;echo "Temp Section cleaned."&lt;br /&gt;&lt;strong&gt;&lt;strong&gt;&lt;br /&gt;echo "\n"&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-4519389935345663293?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cRQVtUACgSaTxgespbvwua1ca_s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cRQVtUACgSaTxgespbvwua1ca_s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cRQVtUACgSaTxgespbvwua1ca_s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cRQVtUACgSaTxgespbvwua1ca_s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/dlG30YGHqxI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/4519389935345663293/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=4519389935345663293" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4519389935345663293?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/4519389935345663293?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/dlG30YGHqxI/binksh-j-in-file-1.html" title="Comparing two columns" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/binksh-j-in-file-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cNRnw7fCp7ImA9WxRSEkQ.&quot;"><id>tag:blogger.com,1999:blog-4374684981300349204.post-3142585679600857748</id><published>2008-09-12T14:47:00.000-07:00</published><updated>2008-09-13T02:44:57.204-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-13T02:44:57.204-07:00</app:edited><title>Replace semicolon with @ in a new line</title><content type="html">&lt;a&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;#!/bin/ksh&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;for i in `ls *.sql`&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;do&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;cat $i | sed '/^$/d' | sed '/;/G' | sed 's/;//g'| sed 's/^$/@/g'&lt;/a&gt; &gt; manu.txt&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#33ff33;"&gt;done&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4374684981300349204-3142585679600857748?l=manutechie.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TrenlslAtwg2H_syJTDPjxt8whc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TrenlslAtwg2H_syJTDPjxt8whc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TrenlslAtwg2H_syJTDPjxt8whc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TrenlslAtwg2H_syJTDPjxt8whc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~4/aTeLS6QUxuo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://manutechie.blogspot.com/feeds/3142585679600857748/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4374684981300349204&amp;postID=3142585679600857748" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/3142585679600857748?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4374684981300349204/posts/default/3142585679600857748?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/UnixBestPracticesShellPerlAwkSedGrepVi/~3/aTeLS6QUxuo/replace-semicolon-with-in-new-line.html" title="Replace semicolon with @ in a new line" /><author><name>Geeeeeeeeeekkkk Manu</name><uri>http://www.blogger.com/profile/02517029897671405269</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="25" height="32" src="http://2.bp.blogspot.com/-m5LgeNzuA00/ThNJzZwvLyI/AAAAAAAAF_M/ErTZB5tdR40/s220/manu%2Bswami.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://manutechie.blogspot.com/2008/09/replace-semicolon-with-in-new-line.html</feedburner:origLink></entry></feed>

