Faka umbhalo othile ekuqaleni noma ekugcineni kwefayela nge-sed, izinkulumo ezijwayelekile

Ngezikhathi ezithile sidinga ukufaka ifayela le- ukugcina kusuka efayeleni umbhalo, kulokhu singasebenzisa i-echo:

echo "Texto al final del archivo" >> archivo.txt

Kepha yini okufanele uyenze uma ngifuna ukufaka umbhalo ekuqaleni?

Nge-sed namapharamitha afanele singakwenza lokhu nokuningi.

Isibonelo, ukufaka kufayela le- ekhaya kusuka efayeleni umbhalo uzoba:

sed -i '1i Aqui texto que ira en la primera linea' archivo.txt

Ngenkathi ukufaka kufayela le- ukugcina es:

sed -i '$a Aqui el texto que ira en la ultima linea' archivo.txt

Noma i-echo yesikhathi sokuphila:

echo "Aqui el texto que ira en la ultima linea" >> archivo.txt

Hhayi, akukho okunye ongangeza, okuthunyelwe okufishane empeleni.

Ngiyethemba umuntu uzokuthola kuwusizo, imikhonzo.


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-18, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   O_Pixote_O kusho

    Uma lokho kufushane uma i-xD. Lapho nginesikhathi esengeziwe kuzofanele ngiphenye umyalo we-sed ngaphezulu, ngicabanga ukuthi kuzoba wusizo kuphrojekthi.

    1.    KZKG ^ Gaara kusho
  2.   masisebenzise i-linux kusho

    ahh ... womile kanjani! 🙂
    quack!

  3.   44 kusho

    la maqhinga-amathiphu angcono kakhulu ... anembile futhi afinyelela ezingeni ... thumela okuningi

    1.    KZKG ^ Gaara kusho

      Siyabonga 🙂
      Ngisenomunye umkhono wami, ngithemba ukuthi ngingawabeka kancane kancane.

  4.   UNebukadinesari kusho

    Njengethiphu enhle njalo.
    Awuzange ucabange (futhi akuyona ihlaya) ukuqoqa wonke amathiphu kanye nokufundiswa kokuphathwa kokuphela kohlelo owabelane nathi ngakho futhi wenza ibhukwana nalo?
    Kungamukeleka kakhulu emphakathini wabasebenzisi beLinux abangaqeqeshiwe uma kubhekwa ukuthi amaphesenti ayisishiyagalolunye wezifundo namanyuwali odaba, noma emazingeni ayisisekelo, ikakhulukazi esiNgisini.
    Ngisho, umqondo omuhle.

    1.    KZKG ^ Gaara kusho

      Kungumqondo omuhle kakhulu, inkinga ukuthi ... angazi, angikwazi kahle kwizifundo zokufundisa noma ezincwadini ezibanzi, kunzima kimi ukuzenza 🙁

  5.   Joaquin kusho

    Ithiphu enhle!

  6.   UMario Guillermo Zavala Silva kusho

    Ngiyabonga kakhulu ngolwazi ... Sanibonani

  7.   i-vidagnu kusho

    Ithiphu enhle kakhulu, ngihlala ne-echo yami yakudala hahaha

  8.   ignacio kusho

    I-tetris ehlelwe ngomyalo we-sed. Kuyamangalisa, akunjalo!

    http://uuner.doslash.org/forfun/sedtris.sed

  9.   marioloko kusho

    Ngimusha kuLinux, kepha kwizikripthi ngisebenzisa umyalo we-sed kakhulu, inketho yokufaka umugqa othile nayo ilungile:
    sed –in-place "(inombolo yomugqa) c \ (Umbhalo esifuna ukuwufaka esikhundleni kulowo mugqa)"

  10.   Mauricio kusho

    Siyabonga !!!!

  11.   Isma kusho

    Uma esikhundleni sokugcina umbhalo ekugcineni kwefayela, esikufunayo ukusindisa umphumela womyalo ekugcineni kwefayela, kungaba kanjani?

    Gracias

  12.   ac kusho

    Futhi uma ngifuna ukufaka umyalo (esikhundleni sombhalo olula) oqukethe if, echo, njll, kufayela, noma ngeza umsebenzi, noma i-alias ????????
    I-gracias

  13.   Swicher kusho

    Nge-sed ungafaka futhi ulayini owodwa noma ngaphezulu noma yikuphi embhalweni njengoba ubona kulesi sibonelo esilandelayo:
    $ echo -en "una linea\notra linea"
    una linea
    otra linea

    $ echo -en "una linea\notra linea" | sed '2i Aquí texto que ira en\n medio de las lineas'
    una linea
    Aquí texto que ira en
    medio de las lineas
    otra linea

    1.    SlaSh kusho

      Okunamandla \ n 😀

  14.   jhon kusho

    futhi uma ngidinga ukufaka izingcaphuno ngaphakathi kwalowo mbhalo ???