This thread here discussed how to output terminal content to a file. Particularly, with this:
command |& tee output.txt
Question: is it possible to utilize part of the output content to name the file. For eg., suppose the content is printed out line by line as following:
action_1_last_time_2021_06_15_21_34_56
action_2_last_time_2021_06_15_21_35_23
action_3_last_time_2021_06_15_21_43_45
...
action_320032_last_time_2021_06_15_23_59_14
Is it possible to use the content of the last line to name the file, instead of out.txt
on the command line? Some sort of variable, maybe? Here, the last line is presumed to be defined as one that appears just before the file is closed (and the command finishes running).