[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



sed -e 's/\(..\)\(....\)\(.*\)/\2\1\3/' in-file > out-file

-Jim P.

On Thu, 2005-05-12 at 17:58 -0400, Greg Freemyer wrote:
> I don't use sed very often, does anyone know how to shift the first 2
> chars of every line to chars 5 & 6.
> 
> In otherwords if I have lines like:
> 
> 123456rest of line.
> 
> I need it to be:
> 
> 345612rest of line.
> 
> PS: Any tool can be used, but I have 80,000 lines to modify in a
> single file, and sed is the only tool I know for the job.
> 
> Thanks
> Greg


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00257" href="msg00257.html">[ale] Need help with a sed script</a></strong>
<ul><li><em>From:</em> greg.freemyer at gmail.com (Greg Freemyer)</li></ul></li>
<li><strong><a name="00282" href="msg00282.html">[ale] Need help with a sed script</a></strong>
<ul><li><em>From:</em> byron at cc.gatech.edu (Byron A Jeff)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00250" href="msg00250.html">[ale] Need help with a sed script</a></strong>
<ul><li><em>From:</em> greg.freemyer at gmail.com (Greg Freemyer)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00253.html">[ale] OT: U.S. National Identity Cards All But Law</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00255.html">[ale] OT: U.S. National Identity Cards All But Law</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00251.html">[ale] Re: Need help with a sed script</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00257.html">[ale] Need help with a sed script</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00254"><strong>Date</strong></a></li>
<li><a href="threads.html#00254"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>