<?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: Shell Scripting: Generate or Print Range of Numbers ( Sequence of Numbers for Loop )</title> <atom:link href="http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: pavium</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-177577</link> <dc:creator>pavium</dc:creator> <pubDate>Tue, 27 Dec 2011 09:07:43 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-177577</guid> <description>I continue to use the &#039;outdated&#039; seq command because of an option you didn&#039;t mention:
The -w option gives a sequence of numbers with equal width, by adding leading zeros if necessary.</description> <content:encoded><![CDATA[<p>I continue to use the &#8216;outdated&#8217; seq command because of an option you didn&#8217;t mention:</p><p>The -w option gives a sequence of numbers with equal width, by adding leading zeros if necessary.</p> ]]></content:encoded> </item> <item><title>By: Ramachandra</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-175263</link> <dc:creator>Ramachandra</dc:creator> <pubDate>Thu, 27 Oct 2011 09:13:07 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-175263</guid> <description>saikumar did you got shell script for your query</description> <content:encoded><![CDATA[<p>saikumar did you got shell script for your query</p> ]]></content:encoded> </item> <item><title>By: Ramachandra</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-175262</link> <dc:creator>Ramachandra</dc:creator> <pubDate>Thu, 27 Oct 2011 09:11:50 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-175262</guid> <description>above question shell script what u need output
=========
#!/bin/sh
for ((i=5; i&gt;=1; i-- ))
do
for ((j=1; j&lt;=i; j++ ))
do
echo -n &quot;$i&quot;
done
echo &quot;&quot;
done
==============
output
55555
4444
333
22
1</description> <content:encoded><![CDATA[<p>above question shell script what u need output<br
/> =========<br
/> #!/bin/sh<br
/> for ((i=5; i&gt;=1; i&#8211; ))<br
/> do<br
/> for ((j=1; j&lt;=i; j++ ))<br
/> do<br
/> echo -n &quot;$i&quot;<br
/> done<br
/> echo &quot;&quot;<br
/> done<br
/> ==============<br
/> output<br
/> 55555<br
/> 4444<br
/> 333<br
/> 22<br
/> 1</p> ]]></content:encoded> </item> <item><title>By: saikumar</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-174776</link> <dc:creator>saikumar</dc:creator> <pubDate>Wed, 12 Oct 2011 14:37:55 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-174776</guid> <description>how to print numbers side by side
i.e
i got the output as
1
2
3
4
5
1
2
3
4
1
2
3
1
2
1
but i neeed the output as
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
how to do ths in shell scripting</description> <content:encoded><![CDATA[<p>how to print numbers side by side</p><p>i.e<br
/> i got the output as<br
/> 1<br
/> 2<br
/> 3<br
/> 4<br
/> 5<br
/> 1<br
/> 2<br
/> 3<br
/> 4<br
/> 1<br
/> 2<br
/> 3<br
/> 1<br
/> 2<br
/> 1<br
/> but i neeed the output as<br
/> 1 2 3 4 5<br
/> 1 2 3 4<br
/> 1 2 3<br
/> 1 2<br
/> 1<br
/> how to do ths in shell scripting</p> ]]></content:encoded> </item> <item><title>By: Phil</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-150638</link> <dc:creator>Phil</dc:creator> <pubDate>Sun, 13 Sep 2009 16:53:34 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-150638</guid> <description>This
&lt;code&gt;
#!/bin/bash
for ((a=1; a &lt;= 5 ; a++))
do
echo &quot;Welcome $i times&quot;
done
&lt;/code&gt;
should be
&lt;code&gt;
#!/bin/bash
for ((a=1; a &lt;= 5 ; a++))
do
echo &quot;Welcome $a times&quot;
done
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>This<br
/> <code><br
/> #!/bin/bash<br
/> for ((a=1; a &lt;= 5 ; a++))<br
/> do<br
/> echo &quot;Welcome $i times&quot;<br
/> done<br
/> </code><br
/> should be<br
/> <code><br
/> #!/bin/bash<br
/> for ((a=1; a &lt;= 5 ; a++))<br
/> do<br
/> echo &quot;Welcome $a times&quot;<br
/> done<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: Tomas Hajny</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-150066</link> <dc:creator>Tomas Hajny</dc:creator> <pubDate>Wed, 12 Aug 2009 07:54:25 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-150066</guid> <description>If you have many (I mean _many_) files in that directory, asterisk expansion may break limits of the command line length; in that case, simple listing combined with head would probably do better:
ls &#124; head -n 100 &#124; lp -d printer-name</description> <content:encoded><![CDATA[<p>If you have many (I mean _many_) files in that directory, asterisk expansion may break limits of the command line length; in that case, simple listing combined with head would probably do better:</p><p>ls | head -n 100 | lp -d printer-name</p> ]]></content:encoded> </item> <item><title>By: dennis</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-148112</link> <dc:creator>dennis</dc:creator> <pubDate>Tue, 14 Apr 2009 07:55:03 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-148112</guid> <description>If you&#039;re only printing 100 out of 10,000 files, you&#039;ll be stuck in that loop for a while unless you break out of it:
cnt=0; for i in *; do if [ $cnt -ge 100 ]; then break; else lp -d printer-name $i; fi; let cnt=cnt+1;done</description> <content:encoded><![CDATA[<p>If you&#8217;re only printing 100 out of 10,000 files, you&#8217;ll be stuck in that loop for a while unless you break out of it:</p><p>cnt=0; for i in *; do if [ $cnt -ge 100 ]; then break; else lp -d printer-name $i; fi; let cnt=cnt+1;done</p> ]]></content:encoded> </item> <item><title>By: mickRacky</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-147920</link> <dc:creator>mickRacky</dc:creator> <pubDate>Tue, 31 Mar 2009 16:11:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-147920</guid> <description>printing the FIRST 100 files:
cnt=0; for i in *; do if [ $cnt -lt 100 ]; then lp -d printer-name $i; fi; let cnt=cnt+1;done</description> <content:encoded><![CDATA[<p>printing the FIRST 100 files:</p><p>cnt=0; for i in *; do if [ $cnt -lt 100 ]; then lp -d printer-name $i; fi; let cnt=cnt+1;done</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-20519</link> <dc:creator>nixcraft</dc:creator> <pubDate>Thu, 26 Oct 2006 14:40:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-20519</guid> <description>&lt;code&gt;cd /path/to/directory
for f in *
do
lp -d printer-name $f
done&lt;/code&gt;
Or simple:
&lt;code&gt;cd /path/to/dir
lp -d printer-name *.txt
&lt;/code&gt;</description> <content:encoded><![CDATA[<p><code>cd /path/to/directory<br
/> for f in *<br
/> do<br
/> lp -d printer-name $f<br
/> done</code></p><p>Or simple:<br
/> <code>cd /path/to/dir<br
/> lp -d printer-name *.txt<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: seshadri sethi</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-20507</link> <dc:creator>seshadri sethi</dc:creator> <pubDate>Thu, 26 Oct 2006 11:07:49 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-20507</guid> <description>i want to know , how to print 100 files  using shell script</description> <content:encoded><![CDATA[<p>i want to know , how to print 100 files  using shell script</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-11630</link> <dc:creator>nixcraft</dc:creator> <pubDate>Wed, 27 Sep 2006 20:08:54 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-11630</guid> <description>Tariq
Good to know that you are upto date with BASH information. I don&#039;t have bash 3 installed here but I am sure it will work out.
Appreciate your post.</description> <content:encoded><![CDATA[<p>Tariq</p><p>Good to know that you are upto date with BASH information. I don&#8217;t have bash 3 installed here but I am sure it will work out.</p><p>Appreciate your post.</p> ]]></content:encoded> </item> <item><title>By: Tariq Rashid</title><link>http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-11531</link> <dc:creator>Tariq Rashid</dc:creator> <pubDate>Tue, 26 Sep 2006 22:27:48 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-generating-print-range-sequence-of-numbers.html#comment-11531</guid> <description>bash3 makes it easier and more portable...
bash-3.00$ for i in {5..10}; do echo $i; done</description> <content:encoded><![CDATA[<p>bash3 makes it easier and more portable&#8230;</p><p>bash-3.00$ for i in {5..10}; do echo $i; done</p> ]]></content:encoded> </item> </channel> </rss>
