Line numberimg
Hi,
is there any more clever way of line numbering, than using nl or cat -n + sed, if I want left trimmed numbers? Quote:
dcop (for who does not know) = Desktop Communication Protocol, that is, the KDE tool for ...............................................data interchange among KDE applications sort | nl ............................... = ordered and line numbered output sed 's/ //' ............................ = left trim of 4 blanks sed 's/\t/ /' ........................... = substitution of the tab with a blank. Is there any shorter command? |
It looks like nl works pretty good alone...
nl file.txt |
What a pity that "nl" does not trim line numbers...
I don't want an output like this: Quote:
Quote:
|
Well I guess I'm missing something here...
This is what I get using FC3 Code:
# dcop | sort | nl |
... and 'voila' what I don't want!
Don't you see that my listy is left trimmed taking into account the highesrt number? |
I have the solution! (from an another forum's guru)
Quote:
Quote:
Quote:
|
Hi all,
I am critically ri-considering my old posts, giving an answer (if I know!) in the hope to be of help to some newbie (as I was some times ago). To be sincere in many arguments I am still a newbie, but anyway... About the item of line numbering, I have found that nl has all I need. The default nl is right padding line numbering up to 6 characters and, besides that, it inserts a tab between the number and the displayed line: Quote:
Quote:
Such trimming can be easily obtained by adding: Quote:
Quote:
I wanted in my original post is: Quote:
Bye. |
All times are GMT -5. The time now is 09:24 PM. |