Questions tagged [nl]

A tool for numbering lines, either from a file or from stdin.

Filter by
Sorted by
Tagged with
1
vote
4answers
74 views

Is there an alphabetic equivalent of nl or seq?

I have a file where I'd like to number the lines using "the alphabet" (simple ascii a, b, c, etc.) instead of numbers. So where I could do: nl somefile I'd like to do something like: abc somefile ...
0
votes
1answer
33 views

“tail” Is Returning the Wrong Requested Number Lines

I'm trying to use the following approach to subset the output of a manual: man dig | nl | tail -n +389 | head -n 6 However, the output starts at line 304, not line 389. Doing some research, it seems ...
0
votes
1answer
21 views

Is it possible to run head & use nl to number the lines?

When i ran head file.txt && nl file.txt it did each command in order of occurance (which makes sense). Is it possible to have the head display with numbered lines, so that this: word word ...
1
vote
2answers
1k views

Line Number for all non-blank lines?

Kind of amused here, I'm trying to pass the prereqs to get into the Udacity Course on High Performance Computer Architecture by Georgia Institute of Technology For the life of me I can't figure out ...
9
votes
4answers
2k views

How to increment line counter for line beginning replacements by AWK/…?

I first thought about SED (sed "s/^/COUNTER \&/" /tmp/1.tex) but it is designed for a single line, and I cannot increment the counter itself by sed so thinking now awk because I have great ...
2
votes
2answers
129 views

How to prepend numerical order on filenames by Zsh/AWK/…?

I would like to prepend numerical order form 1-777 on the orders given to it. You can loop it through and increment variable in Bash. However, I would like to do it with Zsh and/or Awk. An example ...
0
votes
1answer
198 views

nl - numbering input in descending order

Is this possible to number file lines in descending order? That would be something like: nl -i -1 unfortunately this gives me: nl: invalid line number increment: ‘-1’: Numerical result out of ...
0
votes
1answer
114 views

nl add numbers suffix if regex match?

If I have a text file saying this: Xgrep () { something ; } Xgrep Xgrep Xgrep Xgrep Xgrep I want it to look like this Xgrep () { something ; } Xgrep 12 Xgrep 13 Xgrep 14 Xgrep 15 Xgrep 16 ...
1
vote
1answer
1k views

How to add a line number follow by a tab to a text file

I tried using nl -ba -s '\t' full_media > full_media2 But it really did not add the tab, but it added actually the "\t" text after the line number. The file im editing is a CSV file and here by ...
1
vote
2answers
143 views

`nl` invocation soaking all input before numbering

How can this be done? I don't see any applicable option in the manual. I have positively checked that indentation breaks after ten million lines. You can check it like: $ (for i in `seq 0 10000000`...