Follow

Linux question 

is there a command like "less" but that displays a column ruler at the top?

I'm trying to analyze a very complicated fixed-length fields text file.

Linux question 

@yuki emacswiki.org/emacs/RulerMode

Emacs has a ruler mode, but as a whole it's much heavier weight than less

Linux question 

@yuki i haven’t seen any that display it but often CLI text editors like nano or vim will often display the line and column numbers near the bottom separated by a colon, so you could use that (even though it’s not directly what you asked for)

re: Linux question 

@yuki

> is there a command like "less" but that displays a column ruler at the top?

> I'm trying to analyze a very complicated fixed-length fields text file.

I _expected_ that one of `most`, `bat`, or `nushell` would be able to do that pretty easily, but after a quick look I don't see a good way to get them to do so

re: Linux question 

@yuki

> is there a command like "less" but that displays a column ruler at the top?
>
> I'm trying to analyze a very complicated fixed-length fields text file.

One hacky way to get that effect would actually be to use `ed`, of all things. You could paste in a plaintext ruler (which it would ignore, since it's an invalid command) and then use `p` to print the lines you'd like to examine

But there _must_ be a better way!

re: Linux question 

@codesections @yuki something like cut out awk would be able to help you divide up the columns. More likely, you need a specialized tool because I think fixed-length fields are pretty rare nowadays.

Linux question 

@yuki you can use vim with the colorcolumn option
vimdoc.sourceforge.net/htmldoc

It takes a comma separated list of columns to highlight. You can enable it adhoc by running :set colorcolumn=<cols here><Enter> It does require vim 7.3+ but if your system isn't ancient, you should have that.

I'm sure you could even turn it into a one liner with Vim's CLI options.

Linux question 

@yuki you could pipe to a file and open it in vim. It should show column numbers in the bottom right unless it's a feature specific to my statusline. Could also highlight text and look at the count of selected columns

Linux question 

@yuki One more option is `screen`:
Ctrl-A :hardstatus alwaysfirstline 1----5----10---15---20---25---30---35---40---45---50
Then run less as usual

Linux question 

@yuki I would use tmux, split screen in 2, resize, put a ruler in top window, less your file/output in bottom window. or maybe vimless. or redirect output into file and load in text editor.

Linux question 

@yuki Have you tried bat?

github.com/sharkdp/bat

It can show the non-printing chars…

Sign in to participate in the conversation
LGBT.io

We are a Mastodon instance for LGBT+ and allies!