As an alternative to cut
– or awk
-based one-liners, you could use the specialized csvtool
aka ocaml-csv
:
$ csvtool -t ',' col "$index" - < csvfile | grep "$value"
According to the docs, it handles escaping, quoting, etc.
More Related Contents:
- In the shell, what does ” 2>&1 ” mean?
- How to check if a variable is set in Bash
- What is the difference between $(command) and `command` in shell programming?
- Can I export a variable to the environment from a Bash script without sourcing it?
- How to urlencode data for curl command?
- Assigning default values to shell variables with a single command in bash
- redirect COPY of stdout to log file from within bash script itself
- Count occurrences of a char in a string using Bash
- Shell: How to call one shell script from another shell script?
- How to redirect output of an entire shell script within the script itself?
- Quick-and-dirty way to ensure only one instance of a shell script is running at a time
- Process all arguments except the first one (in a bash script)
- How to represent multiple conditions in a shell if statement?
- How to split one string into multiple strings separated by at least one space in bash shell?
- Generating permutations using bash
- Should aliases go in .bashrc or .bash_profile? [duplicate]
- How to read user input into a variable in Bash?
- What does the Bash operator
- What is the exact meaning of IFS=$’\n’?
- Longest line in a file
- Piping and Redirection
- How to write a bash script to set global environment variable?
- What does “plus colon” (“+:”) mean in shell script expressions?
- Running shell command that has nested quotes via ssh
- How to reload .bash_profile from the command line
- Floating point comparison in shell
- How to pipe stdout while keeping it on screen ? (and not to a output file)
- Escaping forward slashes in sed command [duplicate]
- run bash command in new shell and stay in new shell after this command executes
- Subtract two variables in Bash