<?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 on: Using cut &#8211; Shellscript string manipulation</title>
	<atom:link href="http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/</link>
	<description>The Linux Blog, General Linux, Shell Scripts</description>
	<lastBuildDate>Fri, 03 Feb 2012 06:36:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: supertone44</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-6182</link>
		<dc:creator>supertone44</dc:creator>
		<pubDate>Wed, 08 Jun 2011 16:58:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-6182</guid>
		<description>First off, great tutorial and examples. Found exactly what I was needing. 

Can anyone explain to me what the difference is between the ` and &#039; characters. For example, in comment 3109 by thelinuxblog.com they suggested:

NAME=`echo $VAR &#124; cut -d \. -f 1`

I previously had tried wrapping it with the single quote character, which just treated the statement as a string. Can anyone shed some light on the significance of the ` character?

Thanks!</description>
		<content:encoded><![CDATA[<p>First off, great tutorial and examples. Found exactly what I was needing. </p>
<p>Can anyone explain to me what the difference is between the ` and &#8216; characters. For example, in comment 3109 by thelinuxblog.com they suggested:</p>
<p>NAME=`echo $VAR | cut -d \. -f 1`</p>
<p>I previously had tried wrapping it with the single quote character, which just treated the statement as a string. Can anyone shed some light on the significance of the ` character?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: challaa</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-6175</link>
		<dc:creator>challaa</dc:creator>
		<pubDate>Wed, 01 Jun 2011 07:01:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-6175</guid>
		<description>super example for cut command
thanks
challaa</description>
		<content:encoded><![CDATA[<p>super example for cut command<br />
thanks<br />
challaa</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bobo</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-6174</link>
		<dc:creator>Bobo</dc:creator>
		<pubDate>Sat, 28 May 2011 17:11:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-6174</guid>
		<description>Brilliant. You made it quick, simple, and easy.
If only all tutorials could be this way. ;)
Thanks!</description>
		<content:encoded><![CDATA[<p>Brilliant. You made it quick, simple, and easy.<br />
If only all tutorials could be this way. ;)<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheLinuxBlog.com</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-4558</link>
		<dc:creator>TheLinuxBlog.com</dc:creator>
		<pubDate>Sun, 12 Dec 2010 15:46:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-4558</guid>
		<description>@yaker agreed, I&#039;d like to see the last option, the first is always easy since it should be &quot;1&quot;. To get the last field, you&#039;d have to count the number of fields and specify that, or reverse the string and use cut to get the first (which was last) again.

like:&lt;code&gt; cat test.txt &#124; rev &#124; cut -d , -f 1&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@yaker agreed, I&#8217;d like to see the last option, the first is always easy since it should be &#8220;1&#8243;. To get the last field, you&#8217;d have to count the number of fields and specify that, or reverse the string and use cut to get the first (which was last) again.</p>
<p>like:<code> cat test.txt | rev | cut -d , -f 1</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yaker</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-4555</link>
		<dc:creator>yaker</dc:creator>
		<pubDate>Sun, 12 Dec 2010 14:29:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-4555</guid>
		<description>it will be more comfortable if the &quot;-f&quot; param can accept fields such as &quot;first/last&quot;</description>
		<content:encoded><![CDATA[<p>it will be more comfortable if the &#8220;-f&#8221; param can accept fields such as &#8220;first/last&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheLinuxBlog.com</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-3109</link>
		<dc:creator>TheLinuxBlog.com</dc:creator>
		<pubDate>Fri, 29 Jan 2010 16:22:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-3109</guid>
		<description>Hey Maga, assuming the filename in VAR doesn&#039;t have any periods in it you can use:

NAME=`echo $VAR &#124; cut -d \. -f 1`

Here is another way subtracting 5 characters (extension + blankspace) from the $VAR and using the character cut:
echo $VAR &#124; cut -c -$((`echo $VAR&#124; wc -c` - 5))

However, there are probably better ways of doing it.</description>
		<content:encoded><![CDATA[<p>Hey Maga, assuming the filename in VAR doesn&#8217;t have any periods in it you can use:</p>
<p>NAME=`echo $VAR | cut -d \. -f 1`</p>
<p>Here is another way subtracting 5 characters (extension + blankspace) from the $VAR and using the character cut:<br />
echo $VAR | cut -c -$((`echo $VAR| wc -c` &#8211; 5))</p>
<p>However, there are probably better ways of doing it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maga</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-3107</link>
		<dc:creator>Maga</dc:creator>
		<pubDate>Fri, 29 Jan 2010 14:57:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-3107</guid>
		<description>oops, I forgot to say that I want to store the output in a variable, which was my question....

so I&#039;ve tried:

name=echo &quot;${files[$i]}&quot;&#124; cut -d &#039;.&#039; -f 1

and I don&#039;t get anything stored in the variable....</description>
		<content:encoded><![CDATA[<p>oops, I forgot to say that I want to store the output in a variable, which was my question&#8230;.</p>
<p>so I&#8217;ve tried:</p>
<p>name=echo &#8220;${files[$i]}&#8221;| cut -d &#8216;.&#8217; -f 1</p>
<p>and I don&#8217;t get anything stored in the variable&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maga</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-3106</link>
		<dc:creator>Maga</dc:creator>
		<pubDate>Fri, 29 Jan 2010 14:54:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-3106</guid>
		<description>Awesome tutorial on cut!!! Now it&#039;s part of my bookmarks... :) 

I still have one question... I have the name of a file stored in a variable and want to get only the name, not the extension...
I&#039;ve tried 
echo ${files[$i]}&#124; cut -d &#039;.&#039; -f 1 and it doesn&#039;t work... 

could anyone tell me what am missing here?

thx!!</description>
		<content:encoded><![CDATA[<p>Awesome tutorial on cut!!! Now it&#8217;s part of my bookmarks&#8230; :) </p>
<p>I still have one question&#8230; I have the name of a file stored in a variable and want to get only the name, not the extension&#8230;<br />
I&#8217;ve tried<br />
echo ${files[$i]}| cut -d &#8216;.&#8217; -f 1 and it doesn&#8217;t work&#8230; </p>
<p>could anyone tell me what am missing here?</p>
<p>thx!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-2736</link>
		<dc:creator>Roger</dc:creator>
		<pubDate>Mon, 05 Oct 2009 21:06:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-2736</guid>
		<description>Please ignore my previous post. Should have read the manual before posting !

In bash, the default output delimiter is the same as the input delimiter.

--output-delimiter=STRING
       use STRING as the output delimiter the default is to use the input delimiter</description>
		<content:encoded><![CDATA[<p>Please ignore my previous post. Should have read the manual before posting !</p>
<p>In bash, the default output delimiter is the same as the input delimiter.</p>
<p>&#8211;output-delimiter=STRING<br />
       use STRING as the output delimiter the default is to use the input delimiter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger</title>
		<link>http://www.thelinuxblog.com/using-cut-shellscript-string-manipulation/comment-page-1/#comment-2735</link>
		<dc:creator>Roger</dc:creator>
		<pubDate>Mon, 05 Oct 2009 20:48:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.thelinuxblog.com/2007/08/26/using-cut-shellscript-string-manipulation/#comment-2735</guid>
		<description>In bash why can&#039;t I split the expression parfile=/tmp/abc.par into its 2 components where the delimiter is an = sign:

#echo parfile=/tmp/abc.par &#124; cut -f 1-2 -d &quot;=&quot;
parfile=/tmp/abc.par

I tried various versions of it (with the -e to the echo, field list specified as 1,2 as well as 1-2, space after the f, no space after the f).

Nothing is working. Can anyone shed some light?

Thanks</description>
		<content:encoded><![CDATA[<p>In bash why can&#8217;t I split the expression parfile=/tmp/abc.par into its 2 components where the delimiter is an = sign:</p>
<p>#echo parfile=/tmp/abc.par | cut -f 1-2 -d &#8220;=&#8221;<br />
parfile=/tmp/abc.par</p>
<p>I tried various versions of it (with the -e to the echo, field list specified as 1,2 as well as 1-2, space after the f, no space after the f).</p>
<p>Nothing is working. Can anyone shed some light?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

