单个换行符解释两次

问题描述 投票:0回答:1

我指的问题很好地解释了here

重申一下,使用google docs api,我可以使用以下curl命令读取多种格式的文件

curl -X GET -H "Authorization: Bearer $access_token" "https://docs.google.com/feeds/download/documents/export/Export?id=$fileID&exportFormat=txt"

问题是google docs文件中存在的每个换行符都被解释为两个换行符。

这是有问题的,因为当我更新文件的本地副本并将其上传回谷歌文档时,结果是每个换行符被视为两个换行符。你可以想象,这很快失控。

我该如何解决这个问题?

我不能简单地用“\ n”替换每个“\ n \ n”,因为在某些情况下用户可能会想要多个换行符。

我该怎么做呢?

curl google-docs google-docs-api
1个回答
0
投票

我最终创建了一个小的bash脚本来修复这个问题。

如果有其他人遇到这个问题,这是我的(工作?)脚本可能有一些用处。

https://raw.githubusercontent.com/suhussai/GoogleDocApiScript/master/lineFixer.sh

© www.soinside.com 2019 - 2024. All rights reserved.