Ask Your Question
3

How can paths be extracted from the second column in CSV files using Bash?

asked 2022-12-15 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-12-28 06:00:00 +0000

david gravatar image

Assuming that the second column in the CSV file contains paths, you can use the cut command in Bash to extract the paths.

Here's an example command:

cut -d ',' -f 2 input.csv

Explanation:

  • cut is a command in Bash for extracting sections from each line of a file.
  • -d ',' specifies the delimiter as a comma (since the file is CSV).
  • -f 2 specifies the field to extract (the second column).
  • input.csv is the name of the input file.

This command will output the paths from the second column of the CSV file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-12-15 11:00:00 +0000

Seen: 16 times

Last updated: Dec 28 '22