Re: print N times

"[email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>

 In bourne-/bash-shell and with GNU sed you could do:
 

 N=${1:-4}

 echo 'abcd' |

 sed -e "
    /\n/q

    h
    :loop
       G
       s/\n/&/$N
    Tloop
    /\n.*\n/D
    P;d
 "
 

 If GNU sed not there, then we need to resort to the "t"/"b" combo, like as
 

 in place of the Tloop use these three constructs as is:
 

 tend
 bloop
 :end
 

 

 -Rakesh


[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.