So I have a list file that goes like this:




and a directory with the files:


I need to check if the file from the list really exists and if not write it into file.

I was able to create the script to sort out the names of files that I need cat file_path | grep "DAILY" | cut -d '|' -f1 so it's just the names of files.

Any suggestions on how to implement the output into !-f with the daily changing dates?

  • So I was able to write a code to filter out only the names of files and add current date as well, right now I need some suggestions with checking if the files in grep do really exist. cat /project/almvv_import_control_table.csv | grep "DAILY" | cut -d '|' -f1 | sed "s/YYYYMMDD/$(date '+%Y%m%d')/"
    – Gisop
    Jul 22, 2022 at 9:30

1 Answer 1


I've been diving deeper into recently:

gawk -F'|' '
  @load "filefuncs"
  $3 == "DAILY" {
    result = stat($1, statdata)
    if (result != 0)
      print $1
' file.list > files.not.found

Or, expressed as a one-liner:

gawk -l filefuncs -F'|' '$3 == "DAILY" && stat($1, data) {print $1}' file.list > files.not.found

Ref https://www.gnu.org/software/gawk/manual/html_node/Extension-Sample-File-Functions.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .