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*

6
  • This almost worked. I now get ",col1,col2,col3,". I need to remove the first comma after the name Commented Jan 10, 2018 at 19:49
  • I think the extra comma at the beginning might be due to leading whitespaces/new lines? Commented Jan 10, 2018 at 19:55
  • @user2441441, mhmh, well, I can't see the original data you used to produce the comma-separated list, so it's hard to say. Empty lines would cause that, though. Commented Jan 10, 2018 at 19:58
  • Thanks. Do you know how to remove the extra comma? Commented Jan 10, 2018 at 20:00
  • Can you please explain how the command works awk -vORS=, 'p {print $2}; $2 == "name" {p=1} '? Commented Jan 10, 2018 at 20:07