Sed: Ako i te Tuhi Papaanga Ma Te Whakahau i te Whakahau Terminal

Sed: Ako i te Tuhi Papaanga Ma Te Whakahau i te Whakahau Terminal

Sed: Ako i te Tuhi Papaanga Ma Te Whakahau i te Whakahau Terminal

Ko te whakahau "sed" i roto i nga punaha whakahaere koreutu o te momo GNU / Linux he whakahau tino pukenga, mai i te waa E kiia ana he etita kuputuhi e whai ana ki te "rere" hei utu mo te "taunekeneke" hei tauira, i te mea e whakaae ana ki tetahi konae, whakauru whakauru noa ranei hei whakauru, katahi ka tukatukahia ia raina ka tukuna te hua ki te putanga paerewa. Ko te ki te mea, Ma te SED (Kaiwhakatika Rawa) e whakarereke nga korero mo nga raina rereke o te konae i runga i te raupapa o nga ota, o tetahi konae whakahau ranei.

Te tikanga, ko te whakahau «sed» ka whakamahia hei taatari, mai i te waa e panui ana ia raarangi o to urunga raraunga ka mahi i nga mahi e tonoa ana ka panuihia, tango, whakarereke ka whakaatu ka penapena ranei. Ahakoa tona kaha he penei me te mea he pai ki a maatau, he muku raina, he rekoata, he whakakapi ranei i nga aho o te tangata i roto i nga raina o te konae.

Whakataki ki te whakahau "sed"

I etahi atu panui o mua i te DesdeLinux kua korerohia e maatau etahi tauira mo te whakamahinga o tenei whakahau, pēnei i: Me pehea te whakakore i nga raina motuhake mai i te konae ... y Me te Tapeka: Te Whakamahi i nga Whakahau Auau II: Whakakapi, na i tenei waa ka kite tika tatou i tetahi mea tino pakari ake me nga tauira whaihua e whakamahi ana.

Ko te tikanga ko te whakahau «sed» e whai ake nei he wetereo:

sed comandos_sed archivo

Kei hea "Whakahau_whiwhi" e pa ana ki tetahi, ki etahi atu waahanga ranei mo nga raarangi e panuihia ana "puranga".

Ma te nui ake o te whakamahinga ka waiho i a tatou te kupu whai ake:

sed [-ns] '[direccion] instruccion argumentos'

Kei hea:

Hōpututanga Whakahau Tono SED

He tauira whaihua

Rarangi Kōnae / Kōpaki ki te ara

He raina whakahau whai hua hei whakamahi ki te whakariterite i nga korero o te ara X kua tohua ka kitea / tatau / tatari i tetahi taonga kua rapuhia ka tohu he mahi ka whai ake.

ls -l | awk '{ print $NF }' | sed 1d

Hei tauira:

Tauira1: Te whakahau SED - Te Tuhi Papa

Ko tetahi atu rereke e whakamahi ana i te whakahau "sed" he tino whaihua:

find /opt/MilagrOS/file-apps/fondos_pantalla/ -type f | sed 's/^\.\///g' | xargs -n 1 basename

Tauira 4: Te whakahau SED mo te Tuhi Papa

Hangaia he raupapa tau

Whakaatuhia ki runga i te mata ka penapena ranei ki tetahi konae te raupapa tatauranga (tetahi atu whakauru ranei) i hangaia engari me te whakapae (raina) kaore ano i te huarahi poutū ka taea ana te panui mo etahi atu mahinga.

seq 100|tr '\n' ' '|sed 's, $,\n,g'

Tauira 2: Te whakahau SED mo te Tuhi Papa

Ko te tauira ano ka taea ma te whakakotahi i te whakahau «matewai " con "Printf" e whakaaturia ana i raro ake nei:

printf '%s ' {1..100}|sed 's/ $/\n/'

Tauira 3: Te whakahau SED mo te Tuhi Papa

Mukua nga konae me nga whakarerenga

Te tirotiro i tetahi huarahi punaha konae e rapu ana i nga tauira o nga konae ki te aukati me te muku i te toenga o nga korero. He tino whaihua mo te horoi tika me te tupato.

find /opt/MilagrOS/file-apps/fondos_pantalla/ -type f | sed -e '/.*\.txt$/d' -e '/.*\.exe$/d' | xargs rm

Tauira 5: Te whakahau SED mo te TakahuruWhakauru

Waihangahia he wahitau MAC mariko

He pai pea tenei taahiraa mo te ahuru rorohiko hei whakamarumaru ranei i a koe e tirotiro ana i nga waahi morearea, e mahi ana ranei i nga mahi hacking.

MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'` ; echo $MAC

Ko te paanga ano ka tutuki ma te whakamahi i te whakahau "sed" me etahi atu whakahau, penei i raro nei:

openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
od -An -N10 -x /dev/random | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'
od /dev/urandom -w6 -tx1 -An|sed -e 's/ //' -e 's/ /:/g'|head -n 1

Hei tauira:

Tauira 7: Te whakahau SED mo te Tuhi Papa

Me huri mo te wa poto te Whakatairanga Taru

Ma tenei ka awhina i a maatau ki te whakauru i etahi waahanga i roto i ta maatau tere kia whai hua ki a maatau i a maatau e mahi ana i tetahi mahi motuhake. I roto i tenei tauira ka whakarerekehia e maatau te huarahi e whakaatuhia ana te akiaki.

export PS1="C:\$( pwd | sed 's:/:\\\\\\:g' )\\> "

Tauira 8. Te whakahau SED mo te Tuhi Papa

Whakahaerehia te putanga o te "ps" Whakahau

He whakahau whakahau tino whaihua kia ahei te whakatakotoranga o nga putanga o te whakahau «ps», ara, he aha te mea i whiwhi mai i te Kaiwhakahaere Tukatuka Terminal.

sudo ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed "/^ 0.0 /d"

Hei tauira:

Tauira 9: Te whakahau SED mo te Tuhi Papa

Ka taea tenei ki te tono mo nga whakaritenga kia rite ki te haheneti o te maumahara i pau:

sudo ps -e -o pmem,nice,state,cputime,args --sort pmem | sed "/^ 0.0 /d"

Ko enei tauira o nga raina whakahau ma te whakamahi i te whakahau "sed" Ko te tumanako ka whai hua koe. Ana ka whakamahia ki te whakamahi tika mai i te papatohu, kaore ranei ma te whakauru ki roto ki te tuhinga (mahi aunoa).

I roto i te panui e whai ake nei i runga i te Kaituhi Papa ka tirohia e maatau etahi atu whakahau.

Mena kei te hiahia koe ki te ako mo etahi atu korero mo te whakahau "sed" tirohia tenei hono "Akoranga me te Aratohu Poto mo Unix me Linux"Ranei"Te whakamahi taketake»Ana mena kei te hiahia koe ki te ako atu mo te Huri Papaanga i ta maatau ake Blog, ka taea e koe te titiro ki etahi atu panui mo tenei kaupapa, ma te paatene i konei: Te tuhi i roto i te MaiLinux.


Ko nga korero o te tuhinga e piri ana ki o maatau kaupapa o matatika whakatika. Ki te ripoata i tetahi paatene paato Here.

Hei tuatahi ki te korero

Waiho to korero

Ka kore e whakaputaina tō wāhitau īmēra. Kua tohua ngā āpure e hiahiatia ana ki *

*

*

  1. He kawenga mo nga raraunga: Miguel Ángel Gatón
  2. Te kaupapa o te raraunga: Whakahaerehia te SPAM, te whakahaere korero.
  3. Ture: To whakaae
  4. Whakawhitinga korero: Kaore nga korero e tukuna ki nga taha tuatoru engari ma te ture herenga.
  5. Rokiroki raraunga: Paetukutuku e whakahaerehia ana e Occentus Networks (EU)
  6. Tika: I nga wa katoa ka taea e koe te whakaiti, te whakaora me te muku i o korero.