Reputation: 3
How i can change numbers to letters by using sed command linux
for example : if the longitude of numbers is 4 ,5 ,6 o 7 then change this number to abcd.(only sed)
123 1234 123445 125475585
result: 123 abcd abcd abcd
Thanks
Upvotes: 0
Views: 991
Reputation: 88543
With GNU sed:
echo '123 1234 123445 125475585' | sed -E 's/\b[0-9]{4,9}\b/abcd/g'
Output:
123 abcd abcd abcd
Upvotes: 2
Reputation: 798456
The easiest way is to use the map operation.
$ sed 'y/4567/abcd/' <<< '65423476512935'
cba23adcb1293b
Upvotes: 2