Shell exercises 21 files show content three lines as one line

Source: Internet
Author: User

Requirement: One file displays the content three line as a line

Idea: is the second line of content, the contents of the third row is appended to the first row, so that the contents of three lines can become a row, if not enough three lines automatically melt into a row, as follows

[Email protected] shell]# cat/tmp/chy.txt 1234g68 (view chy.txt content) [[email protected] shell]# vim yihang.sh#!/bin/bash# This was San hang Bian Wei Yi hangsed ' N; n;s/\n//g '/tmp/chy.txt (script content explanation: The meaning of n is to add the next line of content to the new line to change the line number, two n is the content of the two rows into a row,/g is to get N content cache instead of Chy.txt content)

Hope to see the children's shoes a lot of advice, thank you!

Shell exercises 21 files show content three lines as one line

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.