Skip to main content
added 96 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

Build the file names in a loop and then test for non-existence of a file:

for day in `seq -f "%03g" 1 30`
  do
  for hour in 0000 0600 1200 1800
    do
    filename="GLDAS_NOAH025SUBP_3H.A2003${day}.${hour}.001.2015210044609.pss.grb"
    if [[ ! -e $filename ]]
    then
      echo "File missing: $filename"
    fi
  done
done

Note: I do not guarantee this example to be error-free. It is an example, not a known-working script.

Portability: needs ksh, bash or zsh and a system with the GNU seq command available.

Build the file names in a loop and then test for non-existence of a file:

for day in `seq -f "%03g" 1 30`
  do
  for hour in 0000 0600 1200 1800
    do
    filename="GLDAS_NOAH025SUBP_3H.A2003${day}.${hour}.001.2015210044609.pss.grb"
    if [[ ! -e $filename ]]
    then
      echo "File missing: $filename"
    fi
  done
done

Note: I do not guarantee this example to be error-free. It is an example, not a known-working script.

Build the file names in a loop and then test for non-existence of a file:

for day in `seq -f "%03g" 1 30`
  do
  for hour in 0000 0600 1200 1800
    do
    filename="GLDAS_NOAH025SUBP_3H.A2003${day}.${hour}.001.2015210044609.pss.grb"
    if [[ ! -e $filename ]]
    then
      echo "File missing: $filename"
    fi
  done
done

Note: I do not guarantee this example to be error-free. It is an example, not a known-working script.

Portability: needs ksh, bash or zsh and a system with the GNU seq command available.

Source Link
John
  • 17.4k
  • 2
  • 36
  • 44

Build the file names in a loop and then test for non-existence of a file:

for day in `seq -f "%03g" 1 30`
  do
  for hour in 0000 0600 1200 1800
    do
    filename="GLDAS_NOAH025SUBP_3H.A2003${day}.${hour}.001.2015210044609.pss.grb"
    if [[ ! -e $filename ]]
    then
      echo "File missing: $filename"
    fi
  done
done

Note: I do not guarantee this example to be error-free. It is an example, not a known-working script.