<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 </font></div><div><font face="arial, helvetica, sans-serif"> 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 </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" <djpfulio@jdpfu.com><br><b>To: </b>"Atlanta Linux Enthusiasts" <ale@ale.org><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>> Leam,<br>> <br>> Your example works, thanks.<br>> <br>> What I had was<br>> <br>> flSunshine<br>> flHeat<br>> flBeaches<br>> <br>> So yes I was trying to get<br>> <br>> fl_Sunshine<br>> fl_heat<br>> fl_Beaches<br>> <br>> On Tue, Jul 26, 2016 at 11:03 AM, DJ-Pfulio <djpfulio@jdpfu.com> wrote:<br>>> I'd use 'rename' ... please post before and after examples. Also, what<br>>> character set is this? Anything funny about the locale? UTF8, UTF16, UTF32 or<br>>> something else? Perl regex handles these things, but you have to tell it correctly.<br>>><br>>> On 07/26/2016 10:43 AM, Chuck Payne wrote:<br>>>> Guys,<br>>>><br>>>> I am still weak on regex. So I have a question. I got a list of<br>>>> directories that I need to add _ too. It should be as the first two<br>>>> character are lower for the state and then the Client name is a Upper<br>>>> Case 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>