LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   add id in the first column (https://www.linuxquestions.org/questions/linux-general-1/add-id-in-the-first-column-256750/)

alaios 11-19-2004 04:09 AM

add id in the first column
 
Hi... I have a text file with one column

e.x
10291
10291
2432
23592
3499
......


I want to add a column in the front with an id
ex
1 10291
2 10291
3 2432
4 23592
5 3499
......

How can i do that using command line?
I think that sed may help me
Any suggestion?

jkobrien 11-19-2004 06:49 AM

awk '{print NR, $0}' FILENAME


All times are GMT -5. The time now is 04:28 PM.