LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 11-19-2004, 04:09 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,133

Rep: Reputation: 45
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?
 
Old 11-19-2004, 06:49 AM   #2
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
awk '{print NR, $0}' FILENAME
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
updating a column in MySQL mohtasham1983 Programming 1 10-28-2005 10:01 AM
SQL question: Need to add a column from another table Hivemind Programming 3 09-19-2005 06:02 PM
Column limit agallant Programming 1 08-05-2004 10:58 AM
sdiff single column? Samsara Linux - Software 0 08-23-2003 07:59 PM
add new column Eddie9 Linux - General 2 04-09-2002 12:05 PM


All times are GMT -5. The time now is 09:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration