shell-grep-sed Common usage

Source: Internet
Author: User

grep
-a digital search to show the next line of information
650) this.width=650; "height=" 290 "src=" http://b176.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ 4vfstywhy8ig7ib7hywauwhpayzyecqfqo*js0neliw!/b/dlaaaaaaaaaa&bo=eqeiaqaaaaafegg! "width=" 377 "style=" vertical-align:top; "alt=" dlaaaaaaaaaa&bo=eqeiaqaaaaafegg! "/>
-B Displays the last line of information after a digital search
650) this.width=650; "height=" 288 "src=" http://b246.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ R9dron.fhdmpi*khzpkb3tmkhzailcgor4.lr3cdze0!/b/dpyaaaaaaaaa&bo=qqegaqaaaaafelo! "width=" 425 "style=" vertical-align:top; "alt=" dpyaaaaaaaaa&bo=qqegaqaaaaafelo! "/>
-C Digital Search to display the information on the downstream
650) this.width=650; "height=" 306 "src=" http://b288.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ s9d75b5h1gn6eplp*mbyflrfqgb8u1t4ulcjw4vz934!/b/dcabaaaaaaaa&bo=cweyaqaaaaafehi! "width=" 371 "style=" vertical-align:top; "alt=" dcabaaaaaaaa&bo=cweyaqaaaaafehi! "/>
The total number of rows with the-c statistic matching criteria
-I ignore Condition case
-N output shows the number of lines in the message
-V To reverse display
--------------------------------------------------------------------------------------------------------
Sed
SED is a non-interactive text editing command, and Vim VI is an interactive edit
Sed ' s/123/456/' file name can change 123 to 456
650) this.width=650; "height=" 367 "src=" http://b287.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ A.. ocfaxisj1zninryy9ymor9cpzlipxmf675lnwvxc!/b/db8baaaaaaaa&bo=9afvaqaaaaafekg! "width=" "style=" vertical-align:top; "alt=" db8baaaaaaaa&bo=9afvaqaaaaafekg! "/>
Sed ' s/[0-9]/(&)/' filename where & means the matching value retrieved from the previous 0-9, then add parentheses
650) this.width=650; "height=" src= "http://b288.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ jtmheh5tejnpgdvxfwvv80h2as.p8rju6orgzmmoqy0!/b/dcabaaaaaaaa&bo=lqfoaqaaaaafem4! "width=" 405 "style=" vertical-align:top; "alt=" dcabaaaaaaaa&bo=lqfoaqaaaaafem4! "/>
In general, SED is the first one in a row, and if you want to check the whole line, you need to add g at the end
650) this.width=650; "height=" 361 "src=" http://b288.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ ubdaagowr*xhdwjhxnu4eeu3k6za3rmulclkof.g9xy!/b/dcabaaaaaaaa&bo=xqfpaqaaaaafej8! "width=" 453 "style=" vertical-align:top; "alt=" dcabaaaaaaaa&bo=xqfpaqaaaaafej8! "/>
Sed in-e can be used with multiple commands consecutively
650) this.width=650; "height=", "src=" http://b287.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ Bh3iluhy8o0dg5o4wziwe*ri8vla0xhddvi6i3falss!/b/db8baaaaaaaa&bo=fgk0aaaaaaafeps! "width=" 638 "style=" vertical-align:top; "alt=" db8baaaaaaaa&bo=fgk0aaaaaaafeps! "/>
D in SED is delete x, $d currently deleted to end
650) this.width=650; "height=" 291 "src=" http://b248.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ . gdnmsvh0hlfuoocr9tw97k7xkh6jef2klbt*q7ox6w!/b/dpgaaaaaaaaa&bo=lqejaqaaaaafeiu! "width=" 405 "style=" vertical-align:top; "alt=" dpgaaaaaaaaa&bo=lqejaqaaaaafeiu! "/>
In sed i is the current line insert a is the next line inserted into the current row
650) this.width=650; "height=" 388 "src=" http://b288.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ vtqbvc84ludxpvtwbbgiytzop9tucwdvqff00yi2dsg!/b/dcabaaaaaaaa&bo=mwgeaqaaaaafecw! "width=" 411 "style=" vertical-align:top; "alt=" dcabaaaaaaaa&bo=mwgeaqaaaaafecw! "/>
SED p is the display output if no-n sed is retrieving all rows, and the matching rows are repeated output after the match is found, that is, the output two times!,-n is not showing the unmatched rows
650) this.width=650; "height=" "src=" http://b173.photo.store.qq.com/psb?/81c1194a-ff39-4e50-b1b1-40057b06260f/ unkijadflgyaqu6z*nbzvuycgotb*otfwbhtr8oylr0!/b/dk0aaaaaaaaa&bo=lqfzaaaaaaafep4! "width=" 405 "style=" vertical-align:top; "alt=" dk0aaaaaaaaa&bo=lqfzaaaaaaafep4! "/>
SED-F specifies that the sed script is sed ' This command can be written directly to the script '

This article is from the "11627223" blog, please be sure to keep this source http://11637223.blog.51cto.com/11627223/1911983

shell-grep-sed Common usage

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.