CSV以Bash格式用逗号和引号引起来

时间:2019-06-27 14:55:40

标签: bash csv

我有一个.csv文件,每个单元格的字符串都非常长,例如:

"*No_Request_Validation* issue exists @ *Views/Search/Web.config*



 Request validation is explicitly disabled by version="1.0"?> in file Views\Search\Web.config at line 1.



 *Application:* R111_Bellca_LiveContent_SHP

 *Cx-Project:* R111_Bellca_LiveContent_SHP

 *Cx-Team:* CxServer\Bell\DCX\Bell.ca

 *Severity:* Medium

 *CWE:* 20



 *Addition Info*

 ----

 [Checkmarx|https://urlhere/CxWebClient/ViewerMain.aspx?scanid=1000353&projectid=136&pathid=184]

 [Mitre Details|https://cwe.mitre.org/data/definitions/20.html]

 [Training|https://cxa.codebashing.com/courses/]

 [Guidance|https://custodela.atlassian.net/wiki/spaces/AS/pages/79462432/Remediation+Guidance]

 Lines: 41 



 ----

 Line #41

 {code}

 validateRequest=""false""

 {code}

 ----

 "

有超过2000个这样的单元格,您可以看到有双引号(“”)和逗号(,)。我使用jq使用@csv将其转换为正确转义的.csv文件,但现在我想将每个单元格放入一个数组元素中。

当我尝试这个

readarray -t eCollection < <(cut -d, -f1 finalfile2.csv)

我没有得到任何接近的信息。 .csv文件基本上有1列,其内容与上述类似,因此我使用-f1,但它仍提供了23个元素(应为2000左右),看起来像是附加了多个单元格

0 个答案:

没有答案