Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Thanks for such a detailed explanation. I am trying to edit the code so that it takes in filenames such as 1230DAY_2020_VACATION and extracts 2020_VACATION and stores them into a variable to use that variable later in the code. I m new to bash so trying to understand as much as possible. Could you let me know how your suggestion would be implemented? And if this particular sed code is called in a function can it work with multiple files as well? Commented Jun 1, 2022 at 3:03
  • 1
    We can attempt to help. Can you provide some more information? Can there be more than one such filename? If so do you want to process them one at a time or all together? Would you consider the environment to be "friendly", so the filenames are not going to be created by people attacking your system? Commented Jun 1, 2022 at 4:41
  • I updated the post with more code. There are functions that are not being called but they are above this code to handle errors does bash run those functions with them being called? @icarus Can there be more than one such filename? If so do you want to process them one at a time or all together? -There can be more than one file but most likely not the same name. Would you consider the environment to be "friendly", so the filenames are not going to be created by people attacking your -- It is friendly Commented Jun 1, 2022 at 15:18