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 do
sed -nr "1 $script p; \$ $script'
I get
datetime (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 like
id
datetime (oldest)
datetime (newest)
is there an (easy) way of editing line 1 twice so it gives 2 separate lines?