You're viewing a comment by kyaw and its responses.
You're viewing a comment by kyaw and its responses.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
I love to read science books. They make my day and I get ideas for awesome blog posts, such as Busy Beaver, On Functors, Recursive Regular Expressions and many others.
Take a look at my
Amazon wish list, if you're curious about what I have planned reading next, and want to surprise me. :)
If you are interested in advertising on catonmat.net, contact me.
Free tools for coding on Vietstarsoft.com.
Programming homework help.


Hi
if code goes like as awk '{ print ++a, $0 }', line numbering included blank lined. But code goes awk 'NF {$0=++a ": " $0}; {print}' that will be add line number to non-blank line.
NF {$0=++a ": " $0} = There must have one field at lease to increase number to var "a" else no action or not take as record for blank line, same time $0 (whole NR ) will become as [var a : ORG_LINE] then print again with all (whole line which newly create include var a value) by print statement after ; .
Comment Responses
Correction : ---
if code goes like as awk '{ print ++a, $0 }', line numbering included blank lined. But code goes awk 'NF {$0=++a ": " $0}; {print}' that will be add line number only to non-blank line. Blank will not get line number.
NF {$0=++a ": " $0} = There must have one field at lease to increase number to var "a" else no action or not take as record for blank line, same time $0 (whole NR ) will become as [var a : ORG_LINE] then print again with all (whole line which newly create include var a value) by print statement after ; .
Reply To This Comment