Uyisebenzisa kanjani imiyalelo esebenza kwifayile enye ngexesha kunye nazo zonke iifayile ozikhethileyo

Amaxesha amaninzi kufuneka sisebenzise iskripthi ukuze siguqule i-pdf ibe sisicatshulwa, siguqule iifayile zeedokodo zibe yi-html, njl. inqaku kukuba le miyalelo yamkela kuphela ifayile enye ngexesha kwaye iyindinisa ukuba sifuna ukwenza umsebenzi ofanayo kwiifayile ezininzi, ngakumbi xa sisenza iscript.

Ndicebisa isisombululo sale ngxaki ndisebenzisa ls, sed, ukubamba, Wowu y sh. Into esiza kuyenza kukwenza umgca olungileyo wokuyalela kumqolo ngamnye kwaye siwenze nge-sh, kwaye ekubeni i-sh iyakwenza umgca omnye ngexesha, ukusetyenziswa kwememori yenkunzi yegusha akuyi kunyuka, ethi ngezinye iindlela ikwazi nokuqandisa oomatshini abaphantsi kwamandla.

Masibone ukuba siwenza njani lo myalelo ngokulandelelana.

1- Into yokuqala ekufuneka siyenzile kukwazisa iifayile eziza kusetyenziswa kuzo ls:

ls --directory /camino/a/carpeta/*.ext

2- Emva koko siya kufuna ezi fayile ukuze sidlulise iikowuti ยซ/ indlela / kwiqela le
iifayileยซ

ls --directory /camino/a/carpeta/*.ext | sed 's/^/"/' | sed 's/$/"/'

3- Ngoku Wowu iya kuba ilungele ukufumana idatha.

ls --directory /camino/a/carpeta/*.ext | sed 's/^/"/' | sed 's/$/"/' | awk '{print $0}'

Ngenxa yokuba Wowu inolwimi lwayo siya kufuna ukwahlula iikowuti esifuna ukubonakala ngathi sicaphula isicatshulwa phakathi kweminye imisebenzi esiza kuyisebenzisa ukusebenzisa umva \ Makhe sibone indlela yokwahlula ezinye.
Yahlula isicatshulwa

\โ€

Bonisa ukubuyela umva kwimveliso (kuya kufuneka sichwetheze iibha ezintathu)

\\\

Ngamanye amaxesha siyakufuna isahluli esizimeleyo, kuphela isicatshulwa okanye iikowuti ezibonakala ngaphakathi kokubuyela umva kabini ziya kuba nesiphumo kwimveliso:

'""'\"\'""'

4- Makhe sibone indlela yokuqamba kwakhona zonke iifayile ezidweliswe usebenzisa umyalelo mv ukufaka nje isimamva. (Ngoku ukudwelisa ifayile esiza kuyidinga ukusebenzisa indibaniselwano "$ 0" ngalo lonke ixesha sifuna ukuyisebenzisa)

ls --directory /camino/a/carpeta/*.ext | sed 's/^/"/' | sed 's/$/"/' | awk '{print "mv "$0" \"`dirname

"$ 0 โ€ณ" / Umbhalo-nayiphi na-`basename "$ 0 โ€ณ" \ ""} '| sh

Inqaku longezwa ekugqibeleni njengoko kubonisiwe kulandelelwano lwangaphambili indibaniselwano ยซ | sh ยปYeyiphi ehambisa kwakhona umbhobho kule toliki yomyalelo

Masibone eminye imizekelo elungiselelwe ukwenza iskripthi.

Imizekelo:

1- Guqula zonke i-pdf zidweliswe kwiifayile ezibhaliweyo.

ls --directory โ€œ$@โ€ | sed 's/^/"/' | sed 's/$/"/' | awk '{print "pdftotext",$0}' | sh

Kule meko akukho mfuneko yokukhetha ifayile yokuphuma kuba i-pdftotext ivelisa ngokuzenzekelayo ifayile yokubhaliweyo enegama lesiseko kunye nokukhululwa .txt ukuba kwaye usebenza kuphela kwifayile enye.

2- Masithi sifuna ukufaka isiphumo emfanekisweni kodwa ngaphandle kokuguqula imvelaphi, masibone umzekelo kunye nefuthe lomtshangatshangiso elaziwa kakuhle ngeWindows XP logo, kuba iyiflegi eneziphumo ze-wavy (ukuqonda ngcono esi siphumo kucetyiswa ukuba usisebenzise umfanekiso obangela ukongezwa .png).

ls --directory โ€œ$@โ€ | sed 's/^/"/' | sed 's/$/"/' | awk '{print FS="convert -wave 25x150

"$0"","\"\`dirname "$0"`/`basename "$0" | sed '"'"s/\\\\.[[:alnum:]]*$//"'"'`-wave.`basename "$0" |
rev | awk -F . \'"'"'\{print $1}\'"'"'\ | rev`'""'\"\'""' "}' | sh

Qaphela: ukudlula okuninzi kwenziwa kolu luhlu:

  • Inye yokufumana ifolda apho ikhoyo ifayile enegama lomdaka
  • Enye yokufumana igama lesiseko, kodwa isusa ulwandiso lwefayile echaziweyo
  • Enye yokufumana ukukhululwa kwale fayile.

3- Masibone ukuba ungaliqamba njani iqela leefayile ngokubeka inombolo ehambelana nayo phambi kwegama (isimamva senombolo)

ls --directory โ€œ$@โ€ | sed 's/^/"/' | sed 's/$/"/' | awk '{print FS="mv "$0" '""'\"\'""'`dirname
"$0"`/"FNR"-`basename "$0"`'""'\"\'""' "}' | sh

Ukufaka inombolo, ulwimi lwangaphakathi lwe-awk lwalusetyenziswa kunye nenketho "FNR" edwelisa umgca ngamnye wemveliso, ke inani linokubekwa ngaphambi okanye emva kokubhaliweyo.

Masibone ukuba sibeka njani isimaphambili senani (beka inani ekugqibeleni, kodwa ngaphambi kokuxolelwa) olu khetho lusebenza kuphela ukuba ifayile inayo.

ls --directory โ€œ$@โ€ | sed 's/^/"/' | sed 's/$/"/' | awk '{print FS="mv "$0" \"`dirname
"$0"`/`basename "$0" | sed '\'s/\\\\.[[:alnum:]]*$//\''`-"FNR".`echo "$0" | rev | awk -F .
'""'\'\'""'{print $1}'""'\'\'""' | rev `\" " }' | sh

4- Masibone umzekelo apho kuya kufuneka singenise idatha okanye ukhethe iqela lemisebenzi, sithathe umzekelo apho sisusa ukhuselo lwegama eligqithisiweyo kwiifayile ezininzi ze-pdf ezinegama elinegama elifanayo. (Kule meko siza kusebenzisa ubunzulu njengebhokisi yencoko yababini)

zenity --entry --hide-text --text "introduzca la clave de desbloqueo" > $HOME/.cat && ls
--directory โ€œ$@โ€ | sed 's/^/"/' | sed 's/$/"/' | awk '{print FS="pdftk "$0" input_pw `cat
$HOME/.cat` output \"`dirname "$0"`/`basename "$0" .pdf`-unlock.pdf\" "}' | sh && rm
$HOME/.cat

Kuxhomekeka kuguqulelo lobukhulu, ukhetho lwegama eligqithisiweyo linokuba lilungile -pasword.

Njengoko ubonile, injongo kukwenza ikati yefayile eya kuthi yenziwe ekuqaleni komgca kube kanye kuphela kwaye iya kupheliswa xa kugqityiwe ukuguqulwa.

5- Enye into eluncedo kukuba, xa sifuna ukudibanisa iifayile ezininzi ezifakwe kwi .zip

ls --directory โ€œ$@โ€ | sed 's/^/"/' | sed 's/$/"/' | awk '{print "unzip -x "$0" "}' | sh

Izicatshulwa ezongezelelweyo kufuneka zahlulwe kunye nendawo apho ukhetho "$ 0" lusetyenziswa
Umzekelo
"unzip -x "$0" "

6- Masibone umzekelo wokukhusela i-pdf ngegama eligqithisiweyo, ukuvumela ukufundwa kodwa kukhuselwe kukopi yoshicilelo okanye ezinye iindlela, (ukhetho oludweliswe kwibhokisi yencoko yababini iya kuba loluya kuvunyelwa kwi-pdf, ukuba awufuni ukuvumela nayiphi na kuzo, musa Khetha nanye).

zenity --separator " " --multiple --text "Seleccione los Opciones que quiere permitir" --column "Opciones" --list "Printing" "DegradedPrinting" "ModifyContents" "CopyContents" "ScreenReaders" "ModifyAnnotations" "AllFeatures" > $HOME/.cat && zenity --entry --hidetext --text "Teclee la contraseรฑa de protecciรณn" > $HOME/.cat2 && ls --directory "$@" | sed 's/^/"/' | sed 's/$/"/' | awk '{print FS="echo \"pdftk \\\"`echo "$0"`\\\" output \\\"`dirname "$0"`/`basename "$0" .pdf`-locked.pdf\\\" allow `cat $HOME/.cat` owner_pw \"`cat $HOME/.cat2`\"\" | sh "}' | sh && rm $HOME/.cat $HOME/.cat2

Ngale mizekelo ibonakalisiwe indlela yokusebenzisa olu khetho ukuguqula, ukuguqula okanye ukuphinda unike igama kwakhona iifayile ezininzi ngeskripthi esinye kwaye ungaziguquli ngesandla ngasinye. Ukusetyenziswa kwememori ngolu khetho kuncinci, kuxhomekeke kumyalelo osetyenziswayo, kuba awubaguquli ngaxeshanye kodwa emva komnye.

Olu khetho lunokuba luncedo kakhulu ukuba sifuna ukuguqula lonke iqela leevidiyo nge-mencoder ngaphandle kokuzibandakanya kwelinye; ungasilungiselela iskripthi koku kwaye baya kufuneka babeke ls --directory %F | sed 's/^/"/' | sed 's/$/"/' | awk '{print "script-convertir-video "$0" "}' | sh && zenity --info --text "Todas las conversiones han terminado"

FIN


Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa. ezidingekayo ziphawulwe *

*

*

  1. Uxanduva lwedatha: UMiguel รngel Gatรณn
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.

      URamiro sitsho

    Ngaba ngekhe ibeninzi, kodwa KULULA KAKHULU ukuyenza yonke le nto usebenzisa amabinzana aqhelekileyo okanye amakhadi wasendle? Andiqondi ukuba yintoni umahluko phakathi kwento nokwenza ubomi bakho bube nzima ngolu hlobo.

      icrotus sitsho

    Inyaniso ihlazisiwe, unolwazi olukhulu lwemiyalelo ye-linux. Iluncedo kakhulu!

         I-KZKG ^ iGaara sitsho

      Ewe ndiyazi sizakufunda lukhulu naye apha ngapha hahaha.

      ileborg sitsho

    Ndicinga ukuba oku kulula kakhulu:

    ls -d / indlela / ukuya kwifolda / ngomxholo | ngelixa ufunda ifayile; yenza UMYALELO "$ file"; yenziwe

    Endaweni ye-COMMAND ungabeka nayiphi na into oyifunayo kwaye iyasebenza nokuba iifayile ziqulathe izithuba ezingenanto ukuba nje ubeka $ fayile phakathi kwezicatshulwa. Awudingi ukusebenzisa i-sed ukulungiselela oko okanye ukuvelisa imiyalelo nge-awk. Kananjalo oku kusungula iinkqubo ezimbalwa.

         Ankh sitsho

      o:
      kuba ndi $ (ls -d /path/a/folder/*.ext); yenza UMYALELO "$ i"; kwenziwe;

           ileborg sitsho

        Oko kujongeka kulungile, kodwa ukuba amagama eefayile aneendawo ezingenanto ayisebenzi. ๐Ÿ™‚

             ukrwada sitsho

          Ngapha koko, i-hexborg yiyo le nto isicatshulwa esikhutshiweyo sicatshulwe ekuqaleni nasekupheleni komgca ngamnye ngolu khetho:
          ls-isikhombisi | sed 's / ^ / ยป/' | sed 's / $ / ยป/'

          Ndicacisa ukuba ukufunyanwa kunokusetyenziselwa ukukhangela kwimithombo engezantsi.

               ileborg sitsho

            Kodwa ngenkohliso awunyanzelekanga ukuba uyenze. ls ithatha amagama apheleleyo eefayile enye kumgca ngamnye kwaye ifunde ukufundwa komgca ngomgca kwaye ishiye igama lefayile kuguquguquko lwefayile nokuba inezikhala ezingenanto okanye hayi. Kufuneka ubeke iikowuti malunga ne- $ fayile xa uyisebenzisa kumyalelo.

               Hugo sitsho

            Ndiyavuma ukuba ekufumaneni kunokuba nzima kakhulu. Masithathe lo mzekelo kwinqaku:

            ls --directory โ€œ$@โ€ | sed 's/^/"/' | sed 's/$/"/' | awk '{print "pdftotext",$0}' | sh

            Okufanayo kunokufezekiswa ngolu hlobo, kwaye kuya kubaleka ngokukhawuleza:

            find . -type f -print0 | xargs -0 pdftotext

            Oko kwathethi, inqaku lamkelekile, kuhlala kulungile ukufunda ngezinye iindlela zokwenza into.

             Ankh sitsho

          Ukuba uqaphela i $ i kwizicatshulwa. Oko kwenza ukubaleka indawo emhlophe kungafuneki.

               ileborg sitsho

            Ewe, kodwa i (() opharetha yandisa amagama efayile ngaphandle kokubeka iikowuti naphina, ngenxa yoko umahluko sele ndibambe amagama weefayile ezisikiweyo. Yizame kwisiphelo sendlela eneefayile ezinezithuba zamagama.

      Leo sitsho

    Ilunge kakhulu, inzima, kodwa inomdla kakhulu.

      hlena_ryuu sitsho

    Oku kuyamangalisa, kuhle !!!!

      msx sitsho

    Ukugqwesa, iplastiki ye-GNU / Linux ayinayo imida.

      Natalia sitsho

    Blogger endimthandayo,

    NdinguNatalia, uMphathi wezoNxibelelwano kwiPhepha leBlog. Emva kokuba ndiyifumene, ndinxibelelana nawe ukuze ndikumeme ukuba uyazi iprojekthi yePhepha lePhepha, http://es.paperblog.com, inkonzo entsha yobuntatheli yabemi. IPhepha elibhaliweyo liqonga ledijithali elithi, njengemagazini yebhlog, lipapashe amanqaku aphambili ebhlog ebhalisiweyo.

    Ukuba umxholo unomdla kuwe, kuya kufuneka uphakamise ibhlog yakho ukuba uthathe inxaxheba. Amanqaku aya kuhamba kunye negama lakho / isibizo kunye nefayile yefayile, kunye neefowuni ezininzi kwiblogi yokuqala, ekuqaleni nasekupheleni kwayo nganye. Ezona zinomdla zinokukhethwa liqela ukuba livele kwiPhepha langaphambili kwaye unokukhethwa njengoMbhali wosuku.

    Ndiyathemba ukuba ukhuthazwa yiprojekthi esiyiqale ngomdla ngoJanuwari 2010. Jonga kwaye ungathandabuzi ukundibhalela ukufumana iinkcukacha ezingaphezulu.

    Fumana umbuliso onobubele nothando,
    Natalia