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*

5
  • I think it's a clear question, but what's output.txt for? Commented Jun 17 at 17:45
  • Hi there! Edited the code to make it clearer now, but don't hesitate to ask more questions @wobtax Commented Jun 17 at 18:29
  • 1
    I can't see the edit yet, but from what it looks like, output.txt is just going to be an empty file. Is the intent to put the output of the while read ... command into output.txt? Commented Jun 18 at 21:51
  • Oops, must have forgotten to hit save! So yes, this completes the scenario: on the one hand I wanted to have formatted text, but on the other I wanted to save it, so this way I was sort of compromising by doing a bit of both, though not at the same time XD. Commented Jun 20 at 20:04
  • 1
    Ah, got it! If you happen to want your loop to read from an input file and overwrite an output file, you can do: while read author; do ... done <input.txt >output.txt, or even while read author; do ... done >output.txt <input.txt. Commented Jun 20 at 20:11