aspose file tools*
The moose likes Linux / UNIX and the fly likes help on awk or sed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "help on awk or sed" Watch "help on awk or sed" New topic
Author

help on awk or sed

vshrivastava
Greenhorn

Joined: Jan 11, 2002
Posts: 1
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

Joined: Oct 25, 2000
Posts: 7292

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.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help on awk or sed