<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'><font face="arial, helvetica, sans-serif"><span style="font-size: 12pt;">The rename command is the best solution, but if you don't have it you could do the same thing this way:</span></font><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><br></div><div><font face="arial, helvetica, sans-serif">for file in *</font></div><div><font face="arial, helvetica, sans-serif">do&nbsp;</font></div><div><font face="arial, helvetica, sans-serif">&nbsp; mv "$file" "${file:0:2}_${file:2}"</font></div><div><font face="arial, helvetica, sans-serif">done</font><br><br><font face="arial, helvetica, sans-serif">I tend to go to the "for file in" solution. I guess I never got in the habit of using rename.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">By the way, if you wanted to get only the directories that began with two lowercase letters followed by an uppercase letter (and exclude other stuff), you could use this in place of the * in either rename... or for file in...:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">[[:lower:]][[:lower:]][[:upper:]]*</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Scott&nbsp;</font><br><br><hr id="zwchr" style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-size: 12pt; font-weight: normal; font-style: normal; text-decoration: none;"><b>From: </b>"DJ-Pfulio" &lt;djpfulio@jdpfu.com&gt;<br><b>To: </b>"Atlanta Linux Enthusiasts" &lt;ale@ale.org&gt;<br><b>Sent: </b>Tuesday, July 26, 2016 12:11:25 PM<br><b>Subject: </b>Re: [ale] help with sed and regex<br><br>How's this?<br><br>$ rename 's/^(.{1,2})/$1_/g' *<br><br><br>On 07/26/2016 11:33 AM, Chuck Payne wrote:<br>&gt; Leam,<br>&gt; <br>&gt; Your example works, thanks.<br>&gt; <br>&gt; What I had was<br>&gt; <br>&gt; flSunshine<br>&gt; flHeat<br>&gt; flBeaches<br>&gt; <br>&gt; So yes I was trying to get<br>&gt; <br>&gt; fl_Sunshine<br>&gt; fl_heat<br>&gt; fl_Beaches<br>&gt; <br>&gt; On Tue, Jul 26, 2016 at 11:03 AM, DJ-Pfulio &lt;djpfulio@jdpfu.com&gt; wrote:<br>&gt;&gt; I'd use 'rename' ... please post before and after examples. &nbsp;Also, what<br>&gt;&gt; character set is this? Anything funny about the locale? &nbsp;UTF8, UTF16, UTF32 or<br>&gt;&gt; something else? Perl regex handles these things, but you have to tell it correctly.<br>&gt;&gt;<br>&gt;&gt; On 07/26/2016 10:43 AM, Chuck Payne wrote:<br>&gt;&gt;&gt; Guys,<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I am still weak on regex. So I have a question. I got a list of<br>&gt;&gt;&gt; directories that I need to add _ too. It should be as the first two<br>&gt;&gt;&gt; character are lower for the state and then the Client name is a Upper<br>&gt;&gt;&gt; Case &nbsp;character. What is the best way to do that?<br><br><br>_______________________________________________<br>Ale mailing list<br>Ale@ale.org<br>http://mail.ale.org/mailman/listinfo/ale<br>See JOBS, ANNOUNCE and SCHOOLS lists at<br>http://mail.ale.org/mailman/listinfo<br></div><br></div></div></body></html>