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*

4
  • Hmm, would normal file paths ever contain spaces? I do not min the end of the output getting aligned. Commented Aug 28, 2022 at 12:59
  • @N3buchadnezzar yes, file paths often contain spaces, assuming they won't and so not handling them properly when they do is a common point of failure for shell scripts. Commented Aug 28, 2022 at 13:02
  • Hmm, interesting. I would be interested in the two pass solution then. As the number of elements is quite small the difference in speed would be negligible. Commented Aug 28, 2022 at 13:06
  • 1
    OK I posted a 2-pass approach. I'm using a shell loop to run your shell command (which is what shell is good for), then an awk script to format the output (which is what awk is good for). Commented Aug 28, 2022 at 13:19