I have a list of filenames as id-datetime.txt, one each line, where id is always the same and datetime is ordered.I need first and last datetime so having a sed_script in a variable $script that grabs it I can dosed -nr 1 $script p; \$ $script'I getdatetime (oldest)datetime (newest)also working with a single-file list.Now what if I'd like to get also another line with also the id likeiddatetime (oldest)datetime (newest)is there an (easy) way of editing line 1 twice so it gives 2 separate lines?
sed: get 2 lines from a single one
sed
Ok, I got it1 {    #hold the line    h    #extract id    s|^([0-9]{6}).*|\1|; p    #put line back again    g    #get datetime    $sed_str}this part of the sed script will print (and edit) the first line twice