views:

51

answers:

1

hi, I need to add text before the last line in a text file in windows using command. Can any one please suggest a method?

Thanks in advance.

+1  A: 

You can do it in 5 simple steps, and you can use any language of your choice or according to your other requirements ( like c, c++, java etc.)

  1. Read Complete File
  2. Extract Last line by looking for last newline
  3. Store Last Line and erase it from file
  4. Append New Text
  5. Append last line which you deleted previously.

Don't forget to close your file.

GG
thanx GG, but is there a single or two lines windows command....???
manoj