Re: File - sed1line.txt

"dave leonard [email protected] [sed-users]" <[email protected]> Wed, 5 Jul 2017 13:00:18 +0000 (UTC)
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Hello All. I have a one liner to print a word n times.
if we want to print the word hello 8 times in 8 lines, below are two methods 
Method # 1 echo hello |sed  'p;  x;  s/^/ /;  / \{8\}/d;  x;  s/^/\n/;  D;' (by using hold space) 
Method # 2 echo hello |sed  ':a  /\n/!s/$/\n/;  P; s/$/ /;  /\n \{8\}$/!ba; d;' (without using hold space) 
if you like it pls add them to your list. 
thanks
dave