fast string conversions

Dear all
I have big ascii files and I want to convert few characters (strings) to some other strings.
I have tried to do this in matlab but it takes ages.

Could you please give me some candidate script language (perl? python?) that is better for handling ascii files?

Best Regards
Alex

To change all occurences of a single character, use “tr”.

To change all occurrences of particular strings, use “sed”

It all depends on what you exactly want to do, but Unix/Linux has different small tools to do things like that.

Translating single characters (like convertiing all occurrencies of ‘d’ in ‘e’ and more of those in one go:

man tr

More sophisticated changes with vi commands in the stream editor:

man sed

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stream Editor (sed) is probably the best for something like this.
Examples of what you want to change from and to may help give an exact
command.

Good luck.

On 06/06/2011 09:36 AM, alaios wrote:
>
> Dear all
> I have big ascii files and I want to convert few characters (strings)
> to some other strings.
> I have tried to do this in matlab but it takes ages.
>
> Could you please give me some candidate script language (perl? python?)
> that is better for handling ascii files?
>
> Best Regards
> Alex
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJN7Pi0AAoJEF+XTK08PnB5lpIP/2gLZqGsKahWaRdyuiSpm70y
z8Klr8s8K8O48ann3wWt5vQQOUcnG5wd49AztmeX53bbtOYDO6ZnfbY3y6lyqooN
Monrr/njfm5LPqGHFuITaZAAu+IwTnPK7TODtlT58pEbVmGlMJ97H8Y4SdPpw29Y
MyAJT9sCmoh2pQXtAwt5YHreKiciONBIqYBMcv33xigX8VYTe9DpD/ean9wEEYCj
jmUideWXrKYUmBw8NE8TmZ1vJm7Wck7n1JdmEiyh6KMolNT6L0Irpbn7wisNGJZF
5pZ/T1EdeGdy4LQycROef1EyZ/Whl3s8HOrY+g2ewN68NqTqlQKjIJWvXSVp8pjb
AZR42URq37dNl+99iZHNaN9AuY2YdbVVmmAeMmPFVNbJA97tBgJUQCSYo6v+ly+p
LX6NQin1+7jG4lqHcQ/GpGVNo8eokFqtShradsPHBpLBw+uorfMw8bZI2bdP4oFa
aZNMOOlDXb3tbWugziKIjMh0KUukK94CCYswxu4XjIw4LeLZU3wUh8/31Y6wz5K6
zvgmts0oupfoT6ImTtSgy2xwEQPyuXB2jaDMOAU8mQyqiRLql87yz4uY4d66cKEy
esLwYhvvX4UQKl1HyQGal1AmN4R5IumkuyW8OFjZsSF0SFCTlj7BbzQtCyGSr+En
eee2YOeq/gMEHhNyAe26
=/Ph7
-----END PGP SIGNATURE-----