Is there a way to use bash to remove the last four columns for some input CSV file? The last four columns can have fields that vary in length from line to line so it is not sufficient to just delete a certain number of characters from the end of each row.
相关问题
- sqlyog export query result as csv
- JQ: Select when attribute value exists in a bash a
- bash print whole line after splitting line with if
- “command not found” errors in expect script execut
- grep using grep results
相关文章
- Check if directory exists on remote machine with s
- How to read local csv file in client side javascri
- Reverse four length of letters with sed in unix
- Launch interactive SSH bash session from PHP
- Symfony : Doctrine data fixture : how to handle la
- BASH: Basic if then and variable assignment
- Bash script that creates a directory structure
- Test if File/Dir exists over SSH/Sudo in Python/Ba
You can use
cut
for this if you know the number of columns. For example, if your file has 9 columns, and comma is your delimiter:However, this assumes the data in your csv file does not contain any commas.
cut
will interpret commas inside of quotes as delimiters also.