Ragaz Mahe
asked on
Deletion of last line in a File & adding a new last line
I am having a file named Trade.txt having n number of lines.
I need the last line to get deleted ( The last line is the string "Report type" ) & I need to add new characters to the last line.
The new character is "Trans Date".
Please help me somebody as I am new to scripting
I need the last line to get deleted ( The last line is the string "Report type" ) & I need to add new characters to the last line.
The new character is "Trans Date".
Please help me somebody as I am new to scripting
@Ragaz
Is the last line the only place the "Report type" string will ever appear in the file?
Is the last line the only place the "Report type" string will ever appear in the file?
ASKER
@aikimark, Its like anywhere in the file the string "report type" would be present. But I need the string in the last line alone to be replaced.
ASKER
@Bill Prew, Kindly be noted that, the said string "report type" would be anywhere in the file. But I need the string in the last line alone to be replaced.
That's what my script did.
»bp
»bp
ASKER
@Bill Prew,
I have tested your code, I could see that the last line is getting replaced with Trans date. At the same time, the string(report type) that is present in all the other places other than the last line is getting disappeared in the output file. Please advise
I have tested your code, I could see that the last line is getting replaced with Trans date. At the same time, the string(report type) that is present in all the other places other than the last line is getting disappeared in the output file. Please advise
Can you run Powershell or VBscript scripts?
ASKER
@aikimark, I am sorry, but i need to run through a BAT or PERL Script
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
»bp