Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

files list field separator does not allow tab character #52

Open
stevegilbert23 opened this issue May 29, 2023 · 7 comments · May be fixed by #113
Open

files list field separator does not allow tab character #52

stevegilbert23 opened this issue May 29, 2023 · 7 comments · May be fixed by #113

Comments

@stevegilbert23
Copy link

I'm using version 3.9.0 on Debian Linux, executing

gdrive files list --full-name --skip-header

The output fields are separated by spaces, which I checked with "od". To eliminate the terminal as a potential complicating factor, I redirected to a file and then did a "od -c -t x1" on the file and it continued to show spaces between fields.

I tried

gdrive files list --full-name --skip-header --field-separator $'\t'

to force the separator to a tab but this did not change the behavior and spaces were still inserted between fields. Note that it is not a single space but it appears there is some calculation going on that is turning tabs into the appropriate number of spaces for display.

I tried specifying other field separators such as ';' and ' ' (single space) and 'Z'. These all resulted in output with a single instance of the specified separator being output between fields, as expected. Based on that, I am using a semi-colon as a workaround.

Am I doing something wrong or is this a bug?

@masterofthesith
Copy link

masterofthesith commented Jun 4, 2023

NO '\t' => ' = meaning not include any variables and schemes skipp all and print
YES "\t" => " = meaning include variables ans schemes not skipp

@kenchou
Copy link

kenchou commented Mar 15, 2024

I expect the output to be separated by tabs.
However, there is currently no way to output tab-separated characters.

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "\t"

Output:

1QYqlYljpRBX7FOthxKDoyP0qo_0QCOSW\tbonus\tfolder\t\t2024-01-02 16:40:59
1qLheqh2cfO44xd7sOuBcOQc5W0qk75PI\tI18N\tfolder\t\t2024-01-02 14:12:59
16d7T9lF_VMbm8kjsfClyst_tScY1HSbn\tequipment\tfolder\t\t2024-01-25 15:30:54

@kenchou kenchou linked a pull request Mar 15, 2024 that will close this issue
@masterofthesith
Copy link

masterofthesith commented Mar 18, 2024

I expect the output to be separated by tabs. However, there is currently no way to output tab-separated characters.

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "\t"

Output:

1QYqlYljpRBX7FOthxKDoyP0qo_0QCOSW\tbonus\tfolder\t\t2024-01-02 16:40:59
1qLheqh2cfO44xd7sOuBcOQc5W0qk75PI\tI18N\tfolder\t\t2024-01-02 14:12:59
16d7T9lF_VMbm8kjsfClyst_tScY1HSbn\tequipment\tfolder\t\t2024-01-25 15:30:54
gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "   "

@kenchou
Copy link

kenchou commented Mar 18, 2024

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "   "

Unfortunately, It still doesn't work.
The reason is that the final output sequence is handed over to TabWriter, which will replace [tab] with several spaces

# Ctrl-V and press the [Tab] key.
gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "    " | hexyl
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 31 51 59 71 6c 59 6c 6a ┊ 70 52 42 58 37 46 4f 74 │1QYqlYlj┊pRBX7FOt│
│00000010│ 68 78 4b 44 6f 79 50 30 ┊ 71 6f 5f 30 51 43 4f 53 │hxKDoyP0┊qo_0QCOS│
│00000020│ 57 20 20 20 20 20 20 20 ┊ 20 20 20 20 20 20 20 62 │W       ┊       b│
│00000030│ 6f 6e 75 73 20 20 20 20 ┊ 20 20 20 20 20 20 20 20 │onus    ┊        │
│00000040│ 20 20 20 20 20 20 66 6f ┊ 6c 64 65 72 20 20 20 20 │      fo┊lder    │
│00000050│ 20 20 20 20 20 20 20 20 ┊ 20 20 20 32 30 32 34 2d │        ┊   2024-│
│00000060│ 30 31 2d 30 32 20 31 36 ┊ 3a 34 30 3a 35 39 0a 31 │01-02 16┊:40:59_1│
│00000070│ 71 4c 68 65 71 68 32 63 ┊ 66 4f 34 34 78 64 37 73 │qLheqh2c┊fO44xd7s│
│00000080│ 4f 75 42 63 4f 51 63 35 ┊ 57 30 71 6b 37 35 50 49 │OuBcOQc5┊W0qk75PI│

@masterofthesith
Copy link

masterofthesith commented Mar 18, 2024

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "   "

Unfortunately, It still doesn't work. The reason is that the final output sequence is handed over to TabWriter, which will replace [tab] with several spaces

# Ctrl-V and press the [Tab] key.
gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "    " | hexyl
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 31 51 59 71 6c 59 6c 6a ┊ 70 52 42 58 37 46 4f 74 │1QYqlYlj┊pRBX7FOt│
│00000010│ 68 78 4b 44 6f 79 50 30 ┊ 71 6f 5f 30 51 43 4f 53 │hxKDoyP0┊qo_0QCOS│
│00000020│ 57 20 20 20 20 20 20 20 ┊ 20 20 20 20 20 20 20 62 │W       ┊       b│
│00000030│ 6f 6e 75 73 20 20 20 20 ┊ 20 20 20 20 20 20 20 20 │onus    ┊        │
│00000040│ 20 20 20 20 20 20 66 6f ┊ 6c 64 65 72 20 20 20 20 │      fo┊lder    │
│00000050│ 20 20 20 20 20 20 20 20 ┊ 20 20 20 32 30 32 34 2d │        ┊   2024-│
│00000060│ 30 31 2d 30 32 20 31 36 ┊ 3a 34 30 3a 35 39 0a 31 │01-02 16┊:40:59_1│
│00000070│ 71 4c 68 65 71 68 32 63 ┊ 66 4f 34 34 78 64 37 73 │qLheqh2c┊fO44xd7s│
│00000080│ 4f 75 42 63 4f 51 63 35 ┊ 57 30 71 6b 37 35 50 49 │OuBcOQc5┊W0qk75PI│

Please try this command

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "|||" | sed -e 's/|||/\t/g''

or

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "|||" | awk '{print $1,$2,$3,$4,$5}' -|column -ts$'|||'

@kenchou
Copy link

kenchou commented Mar 18, 2024

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "|||" | sed -e 's/|||/\t/g'

This command can work. However, it just workaround. Because '|||' is a valid filename.

I think the safest approach is to use tab-separated TSV or comma-separated CSV (with quotes around strings when necessary). These are the most commonly used formats.

@masterofthesith
Copy link

gdrive files list --parent 1V9pg1DQgA4tqEDngxNf7GNAVR-huuTQ2 --full-name --skip-header --field-separator "|||" | sed -e 's/|||/\t/g'

This command can work. However, it just workaround. Because '|||' is a valid filename.

I think the safest approach is to use tab-separated TSV or comma-separated CSV (with quotes around strings when necessary). These are the most commonly used formats.

You right. I just tried to find a quick and easy solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants