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
  • 2
    Unless there's a need to preserve leading/trailing whitespace, couldn't one just do while IFS=';' read -r id name; do ? Commented Apr 8, 2020 at 19:09
  • @steeldriver added to the answer Commented Apr 8, 2020 at 19:29
  • Nice answer, but I’ve started thinking we need to stop using sed to edit files in place. It’s fundamentally a stream editor. The ed command is almost identical and far more portable (given that -i is... tricky). Commented Apr 9, 2020 at 13:27
  • It probably won't make much difference, but if you have a lot of files to process, it might be better to convert the second sed into a second use of -e on the first sed so each file is processed only once. Commented Apr 11, 2020 at 10:34