Transform \\psds0t01\c$ to psds0t01_c
Hello,
I want to transform in a file a string in form \\[a-z]|[A-Z]|[0-9]\[a|z]$ For example: \\psds0t01\c$ to psds0t01_c \\CCR478e0\z$ to CCR478e0_z I try : extract the string in a variable and use tr but \c cause probleme, but \d is good use sed directly from the file gives same bad result Thank you for help |
Hi,
Using sed: sed -e 's/^[\]*//' -e 's/\$$//' -e 's/\\/_/' infile infile contains: \\psds0t01\c$ psds0t01_c \\CCR478e0\z$ CCR478e0_z Test run: $ sed -e 's/^[\]*//' -e 's/\$$//' -e 's/\\/_/' infile psds0t01_c psds0t01_c CCR478e0_z CCR478e0_z Hope this helps. |
s/^\\// - If the first chzracte is a backslash, then convert it to nothing.
s/\\/\_/ - If a back slash, then substitute it with an underscore. s/$\$// - If the last characte is a $, then then convert it to nothing. |
All times are GMT -5. The time now is 04:09 PM. |