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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stripping off end of lines 1

Status
Not open for further replies.

isileth

Technical User
Jul 18, 2001
9
US
I've got a file which looks similar to this (but with many many more lines):

AZ-95-TEST________
BP95_1234_EX______
1_2_3_____________

The software that outputs this list, pads out the end of the character strings with underscores (_) up to a certain length. I need to strip out the underscores that are added purely at the end of the lines, keeping any underscores that are within the character string, so that I'd be left with:

AZ-95-TEST
BP95_1234_EX
1_2_3

I can't get the regular expression right to do this.....

Cheers guys.
 
a way:

sed -e 's/_*$//' input-file >output-file ------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top