<div dir="ltr"><div><div>How is that different than multiple sed options?<br><br></div>In this case scripts/my_script.sh will have a txt version HOWTO/my_script.txt, scripts/cool_stuff.rb will have HOWTO/cool_stuff.txt.<br><br></div>So it's making a .txt file from *.sh or *.rb or perl or python or whatever. From the rename man page it renames the file in place. The original file should remain, I'm just pulling documentation out.<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 6, 2016 at 6:10 PM, DJ-Pfulio <span dir="ltr"><<a href="mailto:DJPfulio@jdpfu.com" target="_blank">DJPfulio@jdpfu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Or use the 'rename' tool? Uses regex, so<br>
<br>
$ rename 's/.rb$/.txt/g' *.rb<br>
<div><div class="h5"><br>
<br>
On 04/06/16 17:52, leam hall wrote:<br>
> I'm trying to do something simple, change the ending of a script to<br>
> ".txt". So if it's my_script.sh it becomes my_script.txt. Likewise for<br>
> my_script.rb, etc. The .txt version will have the documentation and<br>
> comments.<br>
><br>
> So far all I've some up with is:<br>
><br>
> IS_SH=`echo ${SCRIPTNAME} | grep -c sh$`<br>
><br>
> For each expected script ending. Which seems a really ugly thing to do.<br>
> Is there a better way in Bourne shell to do this?<br>
><br>
> Leam<br>
><br>
> --<br>
</div></div>> Mind on a Mission <<a href="http://leamhall.blogspot.com/" rel="noreferrer" target="_blank">http://leamhall.blogspot.com/</a>><br>
<span class="">><br>
><br>
> _______________________________________________<br>
> Ale mailing list<br>
> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
><br>
<br>
<br>
--<br>
</span>Got Linux? Used on smartphones, tablets, desktop computers, media<br>
centers, and servers by kids, Moms, Dads, grandparents and IT<br>
professionals.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div><a href="http://leamhall.blogspot.com/" target="_blank">Mind on a Mission</a></div></div>
</div>