Replacing arbitrary strings with line breaks in windows and linux

Source: Internet
Author: User
Tags ultraedit
If you want to replace any character string with a line break in windows and linux-Linux general technology-Linux programming and kernel information, read the following for details. In windows, you often encounter the problem of converting any symbol into a carriage return. In linux, this problem is easily solved:

\ R press ENTER

\ N line feed

In linux, \ n indicates a new row, and \ r \ n indicates a new row in windows.

Sed's/oldStr/newStr/'oldfile> newfile

Example:

Sed's/,/\ n/'oldfile> newfile

But in windows seems to be able to solve this problem, but the way is always come out, the use of the UltraEdit-32 shortcut Ctrl + H switch to the hexadecimal editing mode can solve this problem. Here is a simple example:

The file now stores the following data. What we want to do now is to convert the comma (,) into a carriage return and line feed. How can this problem be solved?

1, 2, 3
4, 5, 6

Edit it in the UltraEdit-32, switch to the hexadecimal edit mode, as shown below

00000000 h: 31 2C 32 2C 33 0D 0A 34 2C 35 2C 36 2C 36;, 3 .., 6

31 represents 01, 2C represents a comma, 0D 0A represents a carriage return line break, so now the problem becomes simple, select edit-replace

Replace all 2C with 0D 0A, and then replace the comma with the carriage return and line feed.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.