I have multiple files something like: (in reality i have 80)
file1.dat
2 5
6 9
7 1
file2.dat
3 7
8 4
1 3
I want to end up with a file containing all of the second lines. i.e.
output.dat
6 9
8 4
What i have so far loops though the file names but then over-writes the file before it. e.g. the output of the above files would just be
8 4
my shell script looks like this:
post.sh
TEND = 80
TINDX = 0
while [ $TINDX - lt $TEND]; do
awk '{ print NR==2 "input-$TINDX.dat > output.dat
TINDX = $((TINDX+1))
done