Bash shell script help

Hi everyone, first time poster so I hope you'll be gentle with me. :o

I am needing some help to make a script in bash to do the following:

For each file with a name beginning with the string ff_

  • Extract the first line of the file (the date)
  • Change "-" to "/" in the date entry to create a directory path
  • Make the directory
  • Move the file into the new directory
  • Go to the next file

Thank you.

Any attempts / ideas / thoughts from your side?

Hi Rudi,

On the command line I'd assume something along the lines of head -1 ff* | tr �-� �/� to get the dates but not sure how I can then take this forward inside a script after that.

Fine for a first approach. Any thoughts on how to continue with your further steps? Not necessarily in commands / script; plain English will suffice...

1 Like