Read csv file in shell script




















After all, you cat on test, and not on input. Since eykanal mentioned AWk and and sed , I thought I'd show how you could use them. Dennis Williamson Dennis Williamson k 87 87 gold badges silver badges bronze badges. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related Indranil couldn't get u..

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back We use read command to parse comma-delimited values into bash shell. In the above code we have skipped the header line 1, using tail command.

Also we are displaying one column value per line, per row. If you want to print all columns of each row per line, replace do.. I would need a shell command that read all lines of a specific column within a.

In Java i would define it something like :. The separator between columns may indeed change that is why I would like a something quite generic if possible :. The code above displays the searched string foo once for each row where it is the value of column 5 start counting from 1.

The columns are separated by ;. Unfortunately, it doesn't handle quoted strings. If the value in any field contains the separator ; , the CSV format allows enclosing the field value into double quotes " to prevent the separator character be interpreted as a separator forcing its literal value. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams?



0コメント

  • 1000 / 1000