<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
cat /etc/hosts | awk '{ print $1, tolower($2), $3 }' <br><br>Thanks,<br>Al Snow<br><br>> Date: Tue, 4 Aug 2009 14:05:34 -0400<br>> From: jim.kinney@gmail.com<br>> To: ale@ale.org<br>> Subject: [ale] sed head scratcher<br>> <br>> breakout the greybeards....<br>> <br>> <br>> I have a pile of text lines that need to have a certain portion<br>> transposed from upper case (windows dweebs did the hostnames) to lower<br>> case.<br>> <br>> So many lines like:<br>> <br>> 192.168.0.2 MACHINE102<br>> 192.168.3.4 MACHINE304 FredsBox<br>> 10.0.2.3 MACHINE599 TestingSystemB<br>> etc<br>> <br>> So varying IP address then varying spaces then upper case name with<br>> digits then varying spaces and sometimes followed by other name with<br>> mixed case.<br>> <br>> I want to ONLY lower case the names after the IP address, not anything<br>> else in the line.<br>> <br>> Here's what I have so far:<br>> <br>> cat /etc/hosts | sed '/ [A-Z]{7}[0-9]{1,3}/ y/[A-Z]/[a-z]/'<br>> <br>> seems like it should work but it only replaces the 'A' with 'a' and it<br>> does it anywhere in the line.<br>> <br>> So I'm pulling info from http://www.grymoire.com/Unix/Sed.html#uh-49<br>> and it talks about second word in this won't work unless I use<br>> multi-line editing.<br>> <br>> But multi-line editing makes NO SENSE in this context!!<br>> <br>> I could have probably already solved this problem using a different<br>> method/language/beer style but at this point I'm totally geeked out on<br>> this and am being stubborn.<br>> <br>> I appreciate any sed solutions to this.<br>> <br>> -- <br>> -- <br>> James P. Kinney III<br>> Actively in pursuit of Life, Liberty and Happiness<br>> _______________________________________________<br>> Ale mailing list<br>> Ale@ale.org<br>> http://mail.ale.org/mailman/listinfo/ale<br><br /><hr />Express your personality in color! Preview and select themes for HotmailŪ. <a href='http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=PID23391::T:WLMTAGL:ON:WL:en-US:WM_HYGN_express:082009' target='_new'>Try it now.</a></body>
</html>