<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for I ♥ computer&#187; I ♥ computer</title>
	<atom:link href="http://iheartcomputer.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://iheartcomputer.com</link>
	<description>... and I hope you ♥ this blog!</description>
	<lastBuildDate>Sat, 31 Jul 2010 17:45:35 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>Comment on Column manipulation by awhan</title>
		<link>http://iheartcomputer.com/bash-scripting/column-manipulation/comment-page-1/#comment-108</link>
		<dc:creator>awhan</dc:creator>
		<pubDate>Sat, 31 Jul 2010 17:45:35 +0000</pubDate>
		<guid isPermaLink="false">http://iheartcomputer.com/?p=46#comment-108</guid>
		<description>that was extremely useful .. thanks :)</description>
		<content:encoded><![CDATA[<p>that was extremely useful .. thanks <img src='http://iheartcomputer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Column manipulation by biodafes</title>
		<link>http://iheartcomputer.com/bash-scripting/column-manipulation/comment-page-1/#comment-93</link>
		<dc:creator>biodafes</dc:creator>
		<pubDate>Mon, 12 Apr 2010 21:02:05 +0000</pubDate>
		<guid isPermaLink="false">http://iheartcomputer.com/?p=46#comment-93</guid>
		<description>It really depends on how you want to handle the situation.  The idea is that you have a file with a specified structure.  If you don&#039;t have this, then you&#039;re going to get a headache no matter what.  The NF variable is automatically generated inside of awk and contains the number of fields for the particular line that you are on.  You if you are expecting 4 columns on every line you can use this to check whether there is an improperly formated line and handle it accordingly.

inputFile:
1 Foo Joe 123
2 Bar 456
3 Stuff Fred 789

The following will print the first column and and the word EMPTY next to it if the number of fields is equal to 3:

awk &#039;{if (NF==3) print $1&quot; EMPTY&quot;; else print $1,$3}&#039; inputFile
output:
1 Joe
2 EMPTY
3 Fred

Most likely however, you would want to make sure the the number of fields is equal to 4:

awk &#039;{if (NF!=4) print $1&quot; EMPTY&quot;; else print $1,$3}&#039; inputFile
This will get you the same output as above.

If the line is bad, then you probably have no idea which field is missing.  You may want to just print the lines that have 4 columns and generate a error message to stderr.  You would want to use the record number NR (this is the line in the file that you are on) to generate an error message and print the whole line $0.  You write to stderr by redirecting the print statement with this &gt;&quot;/dev/stderr&quot;.

awk &#039;{if (NF!=4) print NR&quot; bad format: &quot;$0 &gt; &quot;/dev/stderr&quot;;  else print $1,$3}&#039; inputFile

You can redirect the errors from this to some file &quot;error.log&quot; and still write a valid oputFile:

awk &#039;{if (NF!=4) print NR&quot; bad format: &quot;$0 &gt; &quot;/dev/stderr&quot;;  else print $1,$3}&#039; inputFile &gt;outputFile 2&gt;error.log

Alternately, you may write directly to error.log from awk:

awk &#039;{if (NF!=4) print NR&quot; bad format: &quot;$0 &gt; &quot;error.log&quot;;  else print $1,$3}&#039; inputFile &gt;outputFile

I would recommend writing to stderr.  If your awk line appears in a script.file then you may redirect all errors from the script to  single file:

script.file 2&gt; allerrors.log</description>
		<content:encoded><![CDATA[<p>It really depends on how you want to handle the situation.  The idea is that you have a file with a specified structure.  If you don't have this, then you're going to get a headache no matter what.  The NF variable is automatically generated inside of awk and contains the number of fields for the particular line that you are on.  You if you are expecting 4 columns on every line you can use this to check whether there is an improperly formated line and handle it accordingly.</p>
<p>inputFile:<br />
1 Foo Joe 123<br />
2 Bar 456<br />
3 Stuff Fred 789</p>
<p>The following will print the first column and and the word EMPTY next to it if the number of fields is equal to 3:</p>
<p>awk '{if (NF==3) print $1" EMPTY"; else print $1,$3}' inputFile<br />
output:<br />
1 Joe<br />
2 EMPTY<br />
3 Fred</p>
<p>Most likely however, you would want to make sure the the number of fields is equal to 4:</p>
<p>awk '{if (NF!=4) print $1" EMPTY"; else print $1,$3}' inputFile<br />
This will get you the same output as above.</p>
<p>If the line is bad, then you probably have no idea which field is missing.  You may want to just print the lines that have 4 columns and generate a error message to stderr.  You would want to use the record number NR (this is the line in the file that you are on) to generate an error message and print the whole line $0.  You write to stderr by redirecting the print statement with this &gt;"/dev/stderr".</p>
<p>awk '{if (NF!=4) print NR" bad format: "$0 &gt; "/dev/stderr";  else print $1,$3}' inputFile</p>
<p>You can redirect the errors from this to some file "error.log" and still write a valid oputFile:</p>
<p>awk '{if (NF!=4) print NR" bad format: "$0 &gt; "/dev/stderr";  else print $1,$3}' inputFile &gt;outputFile 2&gt;error.log</p>
<p>Alternately, you may write directly to error.log from awk:</p>
<p>awk '{if (NF!=4) print NR" bad format: "$0 &gt; "error.log";  else print $1,$3}' inputFile &gt;outputFile</p>
<p>I would recommend writing to stderr.  If your awk line appears in a script.file then you may redirect all errors from the script to  single file:</p>
<p>script.file 2&gt; allerrors.log</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Tune your guitar using the command-line by Dustie</title>
		<link>http://iheartcomputer.com/linux/tune-guitar-commandline/comment-page-1/#comment-57</link>
		<dc:creator>Dustie</dc:creator>
		<pubDate>Thu, 18 Mar 2010 01:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/local/wordpress/?p=19#comment-57</guid>
		<description>Todd Roberts always has made his gutiar talk.  I love it.  You truely are the best lead guitarest ever.  Hes better than Slash ever thought about being....  I am proud of you coz!!!!!  I just wondered where the neighbors were   LOL    Love ya,Dustie</description>
		<content:encoded><![CDATA[<p>Todd Roberts always has made his gutiar talk.  I love it.  You truely are the best lead guitarest ever.  Hes better than Slash ever thought about being....  I am proud of you coz!!!!!  I just wondered where the neighbors were   LOL    Love ya,Dustie</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Why does OpenOffice open my document read-only? by Eric</title>
		<link>http://iheartcomputer.com/openoffice/openoffice-open-document-readonly/comment-page-1/#comment-52</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 09 Mar 2010 22:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://iheartcomputer.com/?p=21#comment-52</guid>
		<description>Does not help; file from the Internet or my own is &quot;read only&quot; and cannot be modified.</description>
		<content:encoded><![CDATA[<p>Does not help; file from the Internet or my own is "read only" and cannot be modified.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Column manipulation by Chad</title>
		<link>http://iheartcomputer.com/bash-scripting/column-manipulation/comment-page-1/#comment-18</link>
		<dc:creator>Chad</dc:creator>
		<pubDate>Sat, 23 Jan 2010 11:51:37 +0000</pubDate>
		<guid isPermaLink="false">http://iheartcomputer.com/?p=46#comment-18</guid>
		<description>What if in your example above &quot;Tom&quot; is missing?
    1  Foo    Joe   123
    2  Bar            456
    3  Stuff  Fred  789

Then if you either extract the 1st adn 3rd columns or cut the 2nd you&#039;ll end up with skewed results because line&#039;s 2nd column is now &quot;456&quot;.</description>
		<content:encoded><![CDATA[<p>What if in your example above "Tom" is missing?<br />
    1  Foo    Joe   123<br />
    2  Bar            456<br />
    3  Stuff  Fred  789</p>
<p>Then if you either extract the 1st adn 3rd columns or cut the 2nd you'll end up with skewed results because line's 2nd column is now "456".</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Tune your guitar using the command-line by Goner</title>
		<link>http://iheartcomputer.com/linux/tune-guitar-commandline/comment-page-1/#comment-11</link>
		<dc:creator>Goner</dc:creator>
		<pubDate>Thu, 10 Dec 2009 18:46:55 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/local/wordpress/?p=19#comment-11</guid>
		<description>Sox 14.3.0 has the pluck synth, 14.2.0 does not.</description>
		<content:encoded><![CDATA[<p>Sox 14.3.0 has the pluck synth, 14.2.0 does not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Tune your guitar using the command-line by xteraco</title>
		<link>http://iheartcomputer.com/linux/tune-guitar-commandline/comment-page-1/#comment-10</link>
		<dc:creator>xteraco</dc:creator>
		<pubDate>Thu, 10 Dec 2009 14:58:33 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/local/wordpress/?p=19#comment-10</guid>
		<description>My guitar has been out of tune for over a year now. Used the script to tune it and jammed for a while. Brings back memories &gt;)</description>
		<content:encoded><![CDATA[<p>My guitar has been out of tune for over a year now. Used the script to tune it and jammed for a while. Brings back memories &gt;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Tune your guitar using the command-line by Todd Roberts</title>
		<link>http://iheartcomputer.com/linux/tune-guitar-commandline/comment-page-1/#comment-9</link>
		<dc:creator>Todd Roberts</dc:creator>
		<pubDate>Thu, 10 Dec 2009 14:21:31 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/local/wordpress/?p=19#comment-9</guid>
		<description>Ok this is cool.  Thanks very much</description>
		<content:encoded><![CDATA[<p>Ok this is cool.  Thanks very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Tune your guitar using the command-line by Tweets that mention Tune your guitar using the command-line – Linux – I ♥ computer -- Topsy.com</title>
		<link>http://iheartcomputer.com/linux/tune-guitar-commandline/comment-page-1/#comment-8</link>
		<dc:creator>Tweets that mention Tune your guitar using the command-line – Linux – I ♥ computer -- Topsy.com</dc:creator>
		<pubDate>Thu, 10 Dec 2009 11:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://localhost/local/wordpress/?p=19#comment-8</guid>
		<description>[...] This post was mentioned on Twitter by John Yerhot, Tim I., Luke Triantafyllidis, stephen, stephen and others. stephen said: Tune your guitar from the command line: http://is.gd/5ho6h [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by John Yerhot, Tim I., Luke Triantafyllidis, stephen, stephen and others. stephen said: Tune your guitar from the command line: <a href="http://is.gd/5ho6h" rel="nofollow">http://is.gd/5ho6h</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Column manipulation by admin</title>
		<link>http://iheartcomputer.com/bash-scripting/column-manipulation/comment-page-1/#comment-7</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 10 Dec 2009 09:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://iheartcomputer.com/?p=46#comment-7</guid>
		<description>Believe it or not, I actually knew of the &quot;Useless use of cat&quot;-phenomenon, but deliberately chose to go the useless way for readability and consistency. Not all commands support reading from files instead of stdin, and some of them have weird syntaxes for it. Moreover, for copy-pasting the commands on this site into the reader&#039;s command-line, I think the piped version is more suitable.

An &quot;easy syntax for column ranges&quot; is a syntax that allows you to specify column &#039;1-99&#039; instead of &#039;$1, $2, $3, ..., $99&#039; or some inlined for loop. I couldn&#039;t find one for awk. If you know one, do tell! And I&#039;m glad you like the site. Now that some comments came in, I have a motivation to start writing for it again!</description>
		<content:encoded><![CDATA[<p>Believe it or not, I actually knew of the "Useless use of cat"-phenomenon, but deliberately chose to go the useless way for readability and consistency. Not all commands support reading from files instead of stdin, and some of them have weird syntaxes for it. Moreover, for copy-pasting the commands on this site into the reader's command-line, I think the piped version is more suitable.</p>
<p>An "easy syntax for column ranges" is a syntax that allows you to specify column '1-99' instead of '$1, $2, $3, ..., $99' or some inlined for loop. I couldn't find one for awk. If you know one, do tell! And I'm glad you like the site. Now that some comments came in, I have a motivation to start writing for it again!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
