I want to replace a normal PATERN1 by a repeating pattern (PATERN2), in my case repeating 'N' 500 times.
Is it possible to do it simply with sed?
sed 's/PATERN1/N{500times}/g'
Cheers,
Ricardo
I want to replace a normal PATERN1 by a repeating pattern (PATERN2), in my case repeating 'N' 500 times.
Is it possible to do it simply with sed?
sed 's/PATERN1/N{500times}/g'
Cheers,
Ricardo
Using sed
you can do this:
s="foo abc PATTERN foo bar PATTERN"
sed "s/PATT[^[:blank:]]*/$(printf '%.0bN' {1..10})/g" <<< "$s"
foo abc NNNNNNNNNN foo bar NNNNNNNNNN
Here printf '%.0bN' {1..10}
will return a string of N
repeated 10 times.