Meaningless Drivel is fun!*
The moose likes Linux / UNIX and the fly likes Read the values from a file and write in the output file with som string. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Read the values from a file and write in the output file with som string." Watch "Read the values from a file and write in the output file with som string." New topic
Author

Read the values from a file and write in the output file with som string.

Saravanan Mrajan
Greenhorn

Joined: Jun 28, 2009
Posts: 18
if the input file contains

454545
090900
343434
and the output would look like,

The first value is 454545
The second value is 090900
The third value is 343434

what is the shell script i can try?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923



http://home.arcor.de/hirnstrom/bewerbung
Saravanan Mrajan
Greenhorn

Joined: Jun 28, 2009
Posts: 18
Stefan Wagner wrote:


Thanks. i wrote the script using awk. anyway i will try this code.

can you explain this a little?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923


Line 1 defines and initializes an array of Strings.
Line 2 init counter n
Line 3 is the head of a for-loop, which reads line by line from the file 'data'.
Line 4 prints to stdout, using the array
Line 5 increases the counter n
Line 6 end of loop

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read the values from a file and write in the output file with som string.