I am tailing two files at the same time, side by side, I can't get a version to work that doesn't use temporary files F1.tmp and F2.tmp.
I would like to use watch to call this script.
Pretty sure I am missing something about command expansion and piping outputs.
FNAME1="$(ls -t | grep '.out'| head -n2 | sort | head -n1)"
FNAME2="$(ls -t | grep '.out'| head -n2 | sort | tail -n1)"
KEY="TIME STEP ="
TS1=`grep "$KEY" "$FNAME1" | tail -n 3`
TF1=`tail -n40 "$FNAME1"`
F1="$FNAME1""$TS1""$TF1\n"
TS2=`grep "$KEY" "$FNAME2" | tail -n 3`
TF2=`tail -n40 "$FNAME2"`
F2="$FNAME2\n\n$TS2\n\n$TF2\n"
echo "$FNAME1" > F1.tmp
echo "$TS1" >> F1.tmp
echo "$TF1" >> F1.tmp
echo "$FNAME2" > F2.tmp
echo "$TS2" >> F2.tmp
echo "$TF2" >> F2.tmp
pr -m -W 144 F1.tmp F2.tmp
pr -m -W 144 <(echo "$TS1") <(echo "$TS2")
Doesn't work
pr -m -W 144 <($TS1) <($TS2)
Doesn't either. For context this is used to monitor CFD output files running on an HPC cluster.
below works on its own, but not when called using watch:
FNAME1="$(ls -t | grep '.out'| head -n2 | sort | head -n1)"
FNAME2="$(ls -t | grep '.out'| head -n2 | sort | tail -n1)"
KEY="TIME STEP ="
TS1=`grep "$KEY" "$FNAME1" | tail -n 3`
TF1=`tail -n40 "$FNAME1"`
F1="$FNAME1\n\n$TS1\n\n$TF1\n"
TS2=`grep "$KEY" "$FNAME2" | tail -n 3`
TF2=`tail -n40 "$FNAME2"`
F2="$FNAME2\n\n$TS2\n\n$TF2\n"
pr -m -W 144 <(printf "$F1") <(printf "$F2")
Seams to work ok on putty, juice ssh makes a mess of the formatting of you change the font size.
Note: I'm searching for occurrences of '$KEY' in the file '$FNAME1'.