You're viewing a comment by Gaurav and its responses.

Gaurav Permalink
May 11, 2012, 14:06

Hi,

I just want to replace 50 variable in just one line for example i want to replace 1,2,3.....upto 50 by aa,ab,ac.... upto bx
kindly suggest...

Comment Responses

May 14, 2012, 13:22

You can do it easily with a Perl one-liner:

perl -pe '@a = aa..bx; s/(\d+)/$a[$1-1]/ge'

Example:

$ perl -pe '@a = aa..bx; s/(\d+)/$a[$1-1]/ge'
1
aa
2
ab
3
ac
26
az
27
ba
50
bx
^C

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "cdrom_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.