Glam Prestige Journal

Bright entertainment trends with youth appeal.

I'm using grep, sed and column to make a little makefile documentation, but I get the following error: column: line too long.

My attempt is the following:

## this is the documentation
yes: @echo hello
help: @grep -Pzo "##.*\n[a-zA-Z0-9_-]+:" $(MAKEFILE_LIST) \ | sed -z "s/\n/,/" \ | sed -n "s/##\(.*\),\(.*\)[:, 1]/\2\1/p" \ | column -t -s ','

I really don't understand the problem here because when I run the command without the column I get a line size way below the 2049 (defined by MAXLINELEN in C code).

Answer

After reading the answer I concluded that I just needed to add a '\n' to the end of my second grep. Like this:

sed -n "s/##\(.*\),\(.*\)[:, 1]/\2\1\n/p"

1 Answer

It's likely because you are passing it a non newline-terminated string:

$ printf 'foo,bar,baz\n' | column -t -s,
foo bar baz

but

$ printf 'foo,bar,baz' | column -t -s,
column: line too long

Perhaps consider replacing sed -z "s/\n/,/" in your pipeline with paste -sd,

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy