sed / awk command to print line number as column?
Hi.
I have a data file containing say 10 columns. I'd like to add a column in the first column position to act as a label - just a column of line numbers. Does anyone know a simple sed / awk command to do this? Thanks |
$ awk '{print NR,$0}' <filename>
This will print the line number along with each field A easier command will be $ nl filename [Or do u want the column numbers on top ? ] - zulfi |
That's perfect.
Thank you. |
All times are GMT -5. The time now is 10:32 PM. |