Shell Programming Four musketeers:
Sed awk grep find
Sed can replace, delete, add, pick, and select data rows for specific tasks
1.sed If you do not add any parameters, you will not be able to modify the contents of the file. The plus-i parameter is modified, such as:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7A/2F/wKiom1aliqGSnCAOAABcJWPJVbc646.jpg "title=" 124b.tmp.jpg "alt=" Wkiom1aliqgsncaoaabcjwpjvbc646.jpg "/>
2. Add spaces or other characters at the beginning of the file, such as:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/2F/wKioL1aljNuA--N8AAA8QvWKZl0245.png "title=" ... png "alt=" Wkiol1aljnua--n8aaa8qvwkzl0245.png "/>
Beginning ^
3. Add characters at the end of the line, such as:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7A/30/wKiom1aljTzw2dOwAAAiPUlDBA8204.png "title=" Test.png "alt=" Wkiom1aljtzw2dowaaaipuldba8204.png "/>
End of Line $
4. Add content after a line, such as:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7A/30/wKiom1aljqCQp0cTAAA6G-Vj5fU175.png "title=" Add.png "alt=" Wkiom1aljqcqp0ctaaa6g-vj5fu175.png "/>
If you want to add content before, change A to I is OK.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/2F/wKioL1alj0bhwRUMAAAeZkhnINc569.png "title=" Add.png "alt=" Wkiol1alj0bhwrumaaaezkhninc569.png "/>
5. Display only one of these lines, such as:
650) this.width=650; "style=" width:558px;height:245px; "src=" http://s3.51cto.com/wyfs02/M00/7A/2F/ Wkiol1alkekwxvoaaaamwc_7txw064.png "title=" "alt=" Wkiol1alkekwxvoaaaamwc_7txw064.png "border=" 0 "height=" 245 " Hspace= "0" vspace= "0" width= "558"/>
Match keyword, "P" "-N"
You can also add line numbers to display as follows:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7A/2F/wKioL1alkvfAQ78ZAABHdNE1b8Q239.png "title=" P.png " alt= "Wkiol1alkvfaq78zaabhdne1b8q239.png"/>
' 1p ' represents the first line
' 1,5p ' represents 1 to 5 rows, with commas in the middle
' 1p; $p ' represents the first line, the last line, and a semicolon in the middle
6. Delete operations, such as:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7A/30/wKiom1allEXiQKrUAABootoQrwI018.png "title=" D.png " alt= "Wkiom1allexiqkruaabootoqrwi018.png"/>
This article is from the "Records" blog, so be sure to keep this source http://lwj421.blog.51cto.com/7119945/1738145
Shell Programming Four Musketeers practice--sed