You are not logged in.

#1 2025-01-20 13:06:24

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,846

[Solved] Editing a TSV file

A (windows) game I play using wine has many of its settings in Tab Separated Values format .

In the past I used a windows utility TxtEdit that was written specifically to handle those files, but many of its features don't work (well) under wine.

text editors can open the file , but don't understand the header layout in the first line of the file.

Libreoffice calc does open the file and separates columns correctly, but has one problem :
text is aligned to the left, numbers are aligned to the right .

Since the columns mix numbers and text, this makes a messy display that also takes more horizontal space then needed if everything was right-aligned .

I do need the ability to change some values , so converting to another format (like ods) is NOT a solution.

Does anyone know a way to change the layout in calc without changing the content OR an editor that aligns tsv columns correctly ?

I uploaded an example file to http://0x0.st/8HpZ.txt


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#2 2025-01-20 15:43:33

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [Solved] Editing a TSV file

Ctrl-a and clicking on your preferred alignment isn't an option?

I personally use VSCode with a CSV plugin that can handle TSV. I'll look it up at home if you're interested, even though I have a feeling you might have strong opinions about vscode smile

Offline

#3 2025-01-20 21:36:54

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,076

Re: [Solved] Editing a TSV file

In calc, you can force all cells to be formatted as text rather than numbers should fix the alignment. Edit: And pressing the alignment button appears to work as well

Last edited by V1del (2025-01-20 21:40:25)

Offline

#4 2025-01-21 13:10:29

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,846

Re: [Solved] Editing a TSV file

In the import window I can use CTRL+A to select all columns and change their type to text.
This works for viewing , I'll have to test if editing values and saving the file changes more then just the edited values.


Using the alignment buttons adds aligment info to the document which is unwanted.

@Awebb :
MS has done many good things and created high quality applications.
Unfortunately code uses electron which means chromium & node.js .

Both have many disadvantages and are not welcome on my personal systems.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2025-01-21 13:25:37

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [Solved] Editing a TSV file

I wasn't aware CSV could hold alignment info, I was under the impression that this was lost on save and had to be done every time you open the file.

Thought so about vscode, but I had to mention it, because it works so well. Never enjoyed csv/tsv until code.

Offline

#6 2025-01-21 22:03:03

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,785

Re: [Solved] Editing a TSV file

So I opened that file in the greatest and best texteditor in the world (tribute) and (because it can read from stdin and I've a curl shortcut I can just copy and paste into that shortcut and *bang* it's there - isn't that awesome? Anyway, I digress) so I opened it and set the tab width to 32 chars and get a relatively reasonable display of that stuff.
You just need to scroll horizontally. Quite a lot.

Basically this should work w/ every texteditor (and maybe even emacs): raise the tab width above the longest token in the table.

Offline

#7 2025-01-22 12:01:16

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,846

Re: [Solved] Editing a TSV file

Changing tab width does indeed improve the display, hadn't thought of that.

In wp 5.1 DOS it was possible to adjust tab stops individually that would be perfect.
Need to verify if current editors still support that.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#8 2025-01-22 14:50:26

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,785

Re: [Solved] Editing a TSV file

You mean have different tab stops for different tabs (1st tab 9em, 2nd tab 32em, 3rd tab 3em, …)?

https://www.riverbankcomputing.com/stat … aBase.html actually seems to allow to set random tab stops - I guess you'd have to special-case the mimetype, parse the first line to get the tab widths(?) or the entire text to find the widest token in each column and set them accordingly.

Sounds like a very niche solution.
If you can't find anything (though I guess you're looking for some word processor like abiword etc?, this isn't how text editors typically act), bump this thread.
I'm not promising anything but sounds challenging and pointless enough wink

Edit: disappointed by sc which cannot handle the tsv format.

Last edited by seth (2025-01-22 14:51:02)

Offline

#9 2025-01-22 15:31:08

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,846

Re: [Solved] Editing a TSV file

Yes, setting tabstops at different locations is what I meant.

Setting manually would be doable as there are just a few files (5 or 6 layouts) I need this for, but there seems to be a better way :

dynamic tabstops  implemented by nick-gravgaard as  elastic tabstops .

There is also  a mention of a plugin for VS studio that adds elastic tabs support to it.
Awebb, could you check if that plugin works with the code editor from arch repos ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#10 2025-01-22 16:37:26

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [Solved] Editing a TSV file

I do not see a VSCode plugin, only Visual Studio.

Offline

#11 2025-01-22 20:15:13

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,785

Re: [Solved] Editing a TSV file

emacs is in that list, I guess the shortcut is ctrl+alt+butterfly smile

Offline

#12 2025-01-23 13:14:17

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,846

Re: [Solved] Editing a TSV file

After looking at the options I am now testing textadept  with the plugin at https://github.com/joshuakraemer/textad … c-tabstops

Things look good and columns are correctly aligned with headers . Some columns are wider then should be necessary, but that's all.

The package builds and runs fast, program also seems lightweight.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#13 2025-01-26 12:53:20

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,846

Re: [Solved] Editing a TSV file

After testing some more with other tsv files I will stay with TextAdept .

I very much prefer having dedicated tools for jobs instead of 1 tool for all jobs and already have 4 editors(nano , mcedit, krusader built-in editor, kate)  installed so don't mind a 5th .

Marking as solved.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB