Marco Education July 28 homework

Source: Internet
Author: User

using Linux has been learned just to complete the following jobs 1. Convert the contents of the/etc/issue file to uppercase and save to the /tmp/issue.out file

Think: The general application of TR, plus the output of the pipeline to the file

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/85/3D/wKioL1ed0LKh8c4SAAAii3daiFE572.png "title=" 1.png " alt= "Wkiol1ed0lkh8c4saaaii3daife572.png"/>

2. Convert the current system login user's information to uppercase and save to the /tmp/who.out file

thinking: Ibid .

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/85/3D/wKiom1ed0MfDW-SpAAAfpAuHqO4972.png "title=" 2.png " alt= "Wkiom1ed0mfdw-spaaafpauhqo4972.png"/>

 

3.  a linux root hello, I am  user name ,thesystem version is here,please help me to check it, thanks! operating system version information

thinking: the application of pipelines, Echo within the command WhoAmI and the Cat View command substitution for operating system information; Mail Use of Commands

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/85/3D/wKiom1ed0QGBaBHSAABHemNN4jM114.png "style=" float: none; "title=" 3.png "alt=" Wkiom1ed0qgbabhsaabhemnn4jm114.png "/>

The contents of the letter are as follows:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/85/3D/wKioL1ed0QLhL47kAABOfLXNjTE307.png "style=" float: none; "title=" 4.png "alt=" Wkiol1ed0qlhl47kaaboflxnjte307.png "/>

4. /root/ The list of files, displaying them as a line, separated by a space between the filenames

echo definition description : echo-display a line of text, display text in a single line

without to replace the newline \ n with [: space:] too complex

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/85/3D/wKiom1ed0UfzXj49AAAkD_NOJuI233.png "title=" 5.png " alt= "Wkiom1ed0ufzxj49aaakd_nojui233.png"/>

The contents of the file are: "1 2 3 4 5 6 7 8 9"   Calculates the sum of all the numbers

thinking: 1 2 3 4 5 6 7 ' are replaced by + , passed to BC man BC understanding BC

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/85/3D/wKioL1ed0XHCgAx_AAAcV2tkFeU940.png "title=" 6.png " alt= "Wkiol1ed0xhcgax_aaacv2tkfeu940.png"/>

6. Remove the ' ^m ' character from the Windows text file

Think: window and Linux file line of difference is: WinDOS file change behavior carriage return +$,linux file line is only $, through #cat-a filename can view the Windows file ^m, the man document TR, you can see \ r Return

Method One:-D,--delete
Delete characters in SET1, does not translate remove SET1 characters

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/85/3D/wKioL1ed0ciSNx2wAAA2aHYIxPM875.png "style=" float: none; "title=" 7.png "alt=" Wkiol1ed0cisnx2waaa2ahyixpm875.png "/>

Method Two:

-S,--squeeze-repeats
Replace each input sequence of a repeated character, that's listed in SET1 with
A single occurrence of that character
This is simply understood as: match SET1 characters, remove duplicates (continuous and same), and show only one.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/85/3D/wKiom1ed0cmSJFP8AAA2a8YNc1I972.png "style=" float: none; "title=" 8.png "alt=" Wkiom1ed0cmsjfp8aaa2a8ync1i972.png "/>


7. Handle the string "Xt.,l 1 jr#! $mn 2 c*/fe 3 uz 4", preserving only the numbers and spaces

Method One:

Thinking:

-C,-C,--complement
Use the complement of SET1 with SET1 complement
-CD that is to delete SET1 the complement set

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/85/3D/wKiom1ed1GnS-RubAAAsYpyYyRY420.png "style=" float: none; "title=" 9.png "alt=" Wkiom1ed1gns-rubaaasypyyyry420.png "/>

Method Two:

Think:-D Delete letters [: Alpha:] and punctuation [:p UNCT:]

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/85/3D/wKioL1ed1G6DN8qBAAAVl8btyIw881.png "style=" float: none; "title=" 10.png "alt=" Wkiol1ed1g6dn8qbaaavl8btyiw881.png "/>

8. Display the PATH variable in a separate row for each directory

Think: simply pipe-pass, replace

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/85/3D/wKioL1ed1enhK9oyAAAXpB7p5Mk226.png "title=" 11.png "alt=" Wkiol1ed1enhk9oyaaaxpb7p5mk226.png "/>

9. Delete blank lines for the specified file

think: Remove duplicates with-s \ n,

considering the need to edit the software, TR cannot make file edits, so reference MV

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/85/3D/wKiom1ed1pazIN1cAAAqgIB-ve4220.png "title=" 12.png "alt=" Wkiom1ed1pazin1caaaqgib-ve4220.png "/>

Question: If the first line of the file is blank line, the individual did not think of the method. Consider using sed to command sed '/^$/d ' -I FILENAME
to display each word (letter) in a file in a separate line, with no blank lines

thinking: The complement of the-C letter, replaced by \ n, and add-s to heavy

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/85/3E/wKiom1eeAZmw4junAAAkPeqHZdo565.png "title=" Image 20160731214751.png "alt=" Wkiom1eeazmw4junaaakpeqhzdo565.png "/>

Question: The same cannot be deleted at the beginning of a blank line. Need to introduce sed command


Marco Education July 28 homework

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.