Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting last two characters of last line in many files 1

Status
Not open for further replies.

bi

Technical User
Apr 13, 2001
1,552
US
What is the sed or awk command to delete the last two character of the last line in a file? There are about 60+ files I have to do this to. The last two characters are always the same: ||

Thanks for any help.
 
sed -e '$s/..$//' myFile

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks, Vlad. I almost had it but didn't put the first $ in. Also, the command didn't work on my Sun box, but does work on my HP system. I guess I'll have to get gsed.

I appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top