[Sussex] Bash string substitution
Ronan Chilvers
ronan at thelittledot.com
Fri Sep 30 12:48:49 UTC 2005
For all you Bashers out there, what's a quick way to substitute 1
character with 2 in a given string. I have a list of filenames I want
to rename via a script, eg:
A-012345.txt
becomes
BC-012345.txt
or
2-A-789.txt
becomes
2-BC-789.txt
Using tr doesn't work because it only substitutes 1 for 1 (ie: A
becomes B not BC).
Any ideas?
Ronan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20050930/ae06dfc7/attachment.pgp
More information about the Sussex
mailing list