Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help on awk or sed

 
vshrivastava
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all,
I need to relese a script by today itself. please help me to do this.
I have a big file lets say 65 thousand lines. it is a tab seperated text file. i need to add one more columne at the end of every line ( tab seperated). the value of that column is the first column of the first line.
example:
Inputfile:
NY^hhhhh^hhhhh^kkkkk^gggg
hhh^jjjjj^9999^44444
888^hhhh^443444^hhhhhh
Output file
NY^hhhhh^hhhhh^kkkkk^gggg^NY
hhh^jjjjj^9999^44444^NY
888^hhhh^443444^hhhhhh^NY
here '^' represent tab character.

please help me ASAP.
vivek S.
viveks@fox.com
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
awk is the better tool for this. sed works with lines as addresses; awk can recognize words on the line more effciently.

That's all you need. Then turn on the execute bit for this file and run it as a program:
$ rex {data_file}
That should do it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic