Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111114 Icedove/3.1.16
Hi,
On 12/22/2011 06:14 PM, Peng Yu wrote:
I want to change how the line number is displayed
~$ echo a | cat -n
1 a
For example, I want it to be shown as
1:a
Although this can be easily done in anything other scripting language,
I'm wondering if there is an even easier way to get it done with cat.
$ echo a | nl -s: -w1
1:a
Option -s specifies which character to use to separate number and line.
Option -w specifies the width of the line number.
See the info page for nl for additional (formatting) options.
Br,
Erik