I want to highlight the end of line with line numbers shown in a different color. I know the command for displaying line number i.e awk '{print $0","NR;}' file but don't know how to highlight end of line. Anyone who can help me with that? I want to do both in a single command if possible.
CodePudding user response:
If your terminal supports ANSI escape codes, you can try this:
awk '{ print $0, "\x1b[7m" NR "\x1b[0m" }' file
CodePudding user response:
You could do something like:
perl -mTerm::ANSIColor=color -lne 'print $_, color("red"), $., color("reset")'
or
perl -mTerm::ANSIColor=RESET,RED -lne 'print $_, RED, $., RESET'
