sed - express strings of dots
These are contrived examples ...
Code:
st="abcdefghijklmnopqrstuvwxyz" Question: how may the sed be written to parameterize the number of dots? Is there a shorthand to express a string of 13 dots as '.'{13} or somesuch? Is there a shorthand to express a string of n dots as '.'{$n} or somesuch? Daniel B. Martin |
Sure. You can either introduce the "[" and "]" characters with "\" to tell sed that they are special
Code:
sed -e 's/\(.\{13\}\)/\1\n/' Code:
sed -r -e 's/(.{13})/\1\n/' |
Quote:
I generalized your sample code this way: Code:
echo; echo "Method #1 of LQ Member rknichols" Code:
Method #1 of LQ Member rknichols Daniel B. Martin |
All times are GMT -5. The time now is 10:22 AM. |