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

Stripping a character

Status
Not open for further replies.

ddrillich

Technical User
Jun 11, 2003
546
US
Good Day,

Our custom app (Collection Manager) generates a file which contains a number. We edited this file with vi and vi introduced a new line character, which prevents the app from reading the file.

Is there a way to strip the new line character from the file?

Regards,
Dan
 
Do you mean ^M at the end of each line?

If so in vi -

:g/^v^M/s// /g

To get the ^v^M bit pres ctrl+v and then ctrl+M. Also note the space after the double slash, this is what you are replacing with.

You should be able to modify this to get rid of any unwanted character.

The basic format is -

:g/old/s//new/g

Steve
 
Or use dos2unix.

Some days are diamonds, some days are rocks - make sure most are the former.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top