Loading ...
Sorry, an error occurred while loading the content.
 

incrementing file name, bagaimana?

Expand Messages
  • md_najmi
    salam, let saya saya nak execute satu for loop for i in *;do python somecode.py result.txt;done mcm mana cara nak redirect output supaya file name jadi
    Message 1 of 7 , Dec 1, 2011
      salam,

      let saya saya nak execute satu for loop

      for i in *;do python somecode.py >> result.txt;done

      mcm mana cara nak redirect output supaya file name jadi result_01.txt,result_02.txt .. so on?


      E.g logik dia

      for i in *;do python somecode.py > result_%2d.txt;done


      thanks.
    • Mohammad Bahathir Hashim
      Here is the sample using bash shell. $ n=0; for f in *.txt; do echo $f - $((n++)) $f; done Pandai-pandailah adjust arahan ini dalam skrip anda. :)
      Message 2 of 7 , Dec 3, 2011
        Here is the sample using bash shell.
        $ n=0; for f in *.txt; do echo $f'-'$((n++)) $f; done

        Pandai-pandailah adjust arahan ini dalam skrip anda. :)


        On Fri, Dec 2, 2011 at 3:58 PM, md_najmi <md_najmi@...> wrote:
        > salam,
        >
        > let saya saya nak execute satu for loop
        >
        > for i in *;do python somecode.py >> result.txt;done
        >
        > mcm mana cara nak redirect output supaya file name jadi result_01.txt,result_02.txt .. so on?
        >
        >
        > E.g logik dia
        >
        > for i in *;do python somecode.py > result_%2d.txt;done
        >
        >
        > thanks.
        >
        >
        >
        > ------------------------------------
        >
        > Salam Aidilfitri kepada semua pelanggan mailing list my-penguin99.
        >
        >
        > Untuk mengeluarkan diri anda dari senarai email ini, hantarkan email ke :
        > mypenguin99-unsubscribe@yahoogroups.comYahoo! Groups Links
        >
        >
        >
      • Mohammad Bahathir Hashim
        Correction: $ n=0; for f in *.txt; do echo $f - $((n++)); done On Sun, Dec 4, 2011 at 12:15 PM, Mohammad Bahathir Hashim
        Message 3 of 7 , Dec 3, 2011
          Correction:
          $ n=0; for f in *.txt; do echo $f'-'$((n++)); done

          On Sun, Dec 4, 2011 at 12:15 PM, Mohammad Bahathir Hashim
          <bahathir@...> wrote:
          > Here is the sample using bash shell.
          > $ n=0;  for f in *.txt; do echo $f'-'$((n++))  $f; done
          >
          > Pandai-pandailah adjust arahan ini dalam skrip anda. :)
          >
          >
          > On Fri, Dec 2, 2011 at 3:58 PM, md_najmi <md_najmi@...> wrote:
          >> salam,
          >>
          >> let saya saya nak execute satu for loop
          >>
          >> for i in *;do python somecode.py >> result.txt;done
          >>
          >> mcm mana cara nak redirect output supaya file name jadi result_01.txt,result_02.txt .. so on?
          >>
          >>
          >> E.g logik dia
          >>
          >> for i in *;do python somecode.py > result_%2d.txt;done
          >>
          >>
          >> thanks.
          >>
          >>
          >>
          >> ------------------------------------
          >>
          >> Salam Aidilfitri kepada semua pelanggan mailing list my-penguin99.
          >>
          >>
          >> Untuk mengeluarkan diri anda dari senarai email ini, hantarkan email ke :
          >> mypenguin99-unsubscribe@yahoogroups.comYahoo! Groups Links
          >>
          >>
          >>
        • Mohammad Bahathir Hashim
          Suggestion. Since you want to use %03d format, and as the alternative, how about use n=1000 in the script, and you are safe up to 9999. :) On Sun, Dec 4,
          Message 4 of 7 , Dec 3, 2011
            Suggestion.
            Since you want to use %03d format, and as the alternative, how about
            use "n=1000' in the script, and you are safe up to 9999. :)

            On Sun, Dec 4, 2011 at 12:17 PM, Mohammad Bahathir Hashim
            <bahathir@...> wrote:
            > Correction:
            > $ n=0;  for f in *.txt; do echo $f'-'$((n++)); done
            >
            > On Sun, Dec 4, 2011 at 12:15 PM, Mohammad Bahathir Hashim
            > <bahathir@...> wrote:
            >> Here is the sample using bash shell.
            >> $ n=0;  for f in *.txt; do echo $f'-'$((n++))  $f; done
            >>
            >> Pandai-pandailah adjust arahan ini dalam skrip anda. :)
            >>
            >>
            >> On Fri, Dec 2, 2011 at 3:58 PM, md_najmi <md_najmi@...> wrote:
            >>> salam,
            >>>
            >>> let saya saya nak execute satu for loop
            >>>
            >>> for i in *;do python somecode.py >> result.txt;done
            >>>
            >>> mcm mana cara nak redirect output supaya file name jadi result_01.txt,result_02.txt .. so on?
            >>>
            >>>
            >>> E.g logik dia
            >>>
            >>> for i in *;do python somecode.py > result_%2d.txt;done
            >>>
            >>>
            >>> thanks.
            >>>
            >>>
            >>>
            >>> ------------------------------------
            >>>
            >>> Salam Aidilfitri kepada semua pelanggan mailing list my-penguin99.
            >>>
            >>>
            >>> Untuk mengeluarkan diri anda dari senarai email ini, hantarkan email ke :
            >>> mypenguin99-unsubscribe@yahoogroups.comYahoo! Groups Links
            >>>
            >>>
            >>>
          • md_najmi
            thanks bro. actually bila dah tgk file, saya rasa better guna cara lain (maksudnya numbering mcm tu tak sesuai utk projek saya) for f in *;do python
            Message 5 of 7 , Dec 4, 2011
              thanks bro.

              actually bila dah tgk file, saya rasa better guna cara lain (maksudnya numbering mcm tu tak sesuai utk projek saya)

              for f in *;do python ~/pi-ngaji/nav6-pi-ngaji.py $f >> result-"$f"; done

              so dalam kes ni * adalah md5sum file.. jadi elok gune result-md5, lebih presentable.

              tq

              --- In mypenguin99@yahoogroups.com, Mohammad Bahathir Hashim <bahathir@...> wrote:
              >
              > Suggestion.
              > Since you want to use %03d format, and as the alternative, how about
              > use "n=1000' in the script, and you are safe up to 9999. :)
              >
              > On Sun, Dec 4, 2011 at 12:17 PM, Mohammad Bahathir Hashim
              > <bahathir@...> wrote:
              > > Correction:
              > > $ n=0;  for f in *.txt; do echo $f'-'$((n++)); done
              > >
              > > On Sun, Dec 4, 2011 at 12:15 PM, Mohammad Bahathir Hashim
              > > <bahathir@...> wrote:
              > >> Here is the sample using bash shell.
              > >> $ n=0;  for f in *.txt; do echo $f'-'$((n++))  $f; done
              > >>
              > >> Pandai-pandailah adjust arahan ini dalam skrip anda. :)
              > >>
              > >>
              > >> On Fri, Dec 2, 2011 at 3:58 PM, md_najmi <md_najmi@...> wrote:
              > >>> salam,
              > >>>
              > >>> let saya saya nak execute satu for loop
              > >>>
              > >>> for i in *;do python somecode.py >> result.txt;done
              > >>>
              > >>> mcm mana cara nak redirect output supaya file name jadi result_01.txt,result_02.txt .. so on?
              > >>>
              > >>>
              > >>> E.g logik dia
              > >>>
              > >>> for i in *;do python somecode.py > result_%2d.txt;done
              > >>>
              > >>>
              > >>> thanks.
              > >>>
              > >>>
              > >>>
              > >>> ------------------------------------
              > >>>
              > >>> Salam Aidilfitri kepada semua pelanggan mailing list my-penguin99.
              > >>>
              > >>>
              > >>> Untuk mengeluarkan diri anda dari senarai email ini, hantarkan email ke :
              > >>> mypenguin99-unsubscribe@...! Groups Links
              > >>>
              > >>>
              > >>>
              >
            • ahmad arafat
              Salam pada semua.. Tahun 2012 nih saya rasa kita dah lama tak jumpa2 minum2 sama2.. jom plan? tgk pun kita aktif di FB dan jumpa kawan2 lama samada mypengin99,
              Message 6 of 7 , Feb 8, 2012
                Salam pada semua..

                Tahun 2012 nih saya rasa kita dah lama tak jumpa2 minum2 sama2.. jom plan?

                tgk pun kita aktif di FB dan jumpa kawan2 lama samada mypengin99, rindu.net dan lain2.. ada yg terpisah dan terjumpa balik.. why not kita wat perjumpaan mcm dulu2.. port pakat sama2 bincang..

                p/s: lama xjumpa abg root

                 


                netbsd# uname -a
                NetBSD netbsd.trunasuci.opensource.my 5.0.0_PATCH NetBSD 5.0.0_PATCH (GENERIC) #0: Sun May 3 13:37:36 MYT 2009 root@...:/usr/obj/sys/arch/i386/compile/GENERIC i386


                ________________________________


                MARKETPLACE
                Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.<img width="1" height="1" alt="" src="http://us.bc.yahoo.com/b?P=7ded4cf2-1e86-11e1-9dd1-4f9355c582c2&T=1d8g9tom6%2fX%3d1323009878%2fE%3d1705006580%2fR%3dgroups%2fK%3d5%2fV%3d2.1%2fW%3dH%2fY%3dYAHOO%2fF%3d119596780%2fH%3dY29udGVudD0iR287UG9kY2FzdHM7V2lkZ2V0cztGbGlja3I7QnJpZWZjYXNlO1lhaG9vX1NlYXJjaF9NYXJrZXRpbmc7Qm9va21hcms7TW9iaWxlO0dyb3VwcztLbm93bGVkZ2VfU2VhcmNoOyIgZGlzYWJsZXNodWZmbGluZz0iMSIgc2VydmVJZD0iN2RlZDRjZjItMWU4Ni0xMWUxLTlkZDEtNGY5MzU1YzU4MmMyIiBzaXRlSWQ9IjQ0NTI1NTEiIHRTdG1wPSIxMzIzMDA5ODc4NDk4MzE1IiA-%2fQ%3d-1%2fS%3d1%2fJ%3d28228962&U=13ccg2vai%2fN%3dZTsSNtGDJGQ-%2fC%3d493064.14543979.14562481.13298430%2fD%3dMKP1%2fB%3d6060255%2fV%3d1">

                Switch to: Text-Only, Daily Digest • Unsubscribe • Terms of Use
                .



                [Non-text portions of this message have been removed]
              • Mohammad Bahathir Hashim
                ... MOSC tahun lepas :) Ok, jom kita jumpa... dan cuba cadangkan tempat dan waktu. FYI, saya akan pergi PWTC, Sabtu ini tengok exhibition, tapi tak pasti jam
                Message 7 of 7 , Feb 8, 2012
                  :) ... Kan dah 2,3 kali jumpa kat stesen komuter Kepong Sentral dab
                  MOSC tahun lepas :) Ok, jom kita jumpa... dan cuba cadangkan tempat
                  dan waktu.

                  FYI, saya akan pergi PWTC, Sabtu ini tengok exhibition, tapi tak pasti
                  jam berapa. :)

                  Terima kasih.


                  2012/2/9 ahmad arafat <trunasuci_74@...>:
                  > Salam pada semua..
                  >
                  > Tahun 2012 nih saya rasa kita dah lama tak jumpa2 minum2 sama2.. jom plan?
                  >
                  > tgk pun kita aktif di FB dan jumpa kawan2 lama samada mypengin99, rindu.net dan lain2.. ada yg terpisah dan terjumpa balik.. why not kita wat perjumpaan mcm dulu2.. port pakat sama2 bincang..
                  >
                  > p/s: lama xjumpa abg root
                  >
                  >
                  >
                  >
                  > netbsd# uname -a
                  > NetBSD netbsd.trunasuci.opensource.my 5.0.0_PATCH NetBSD 5.0.0_PATCH (GENERIC) #0: Sun May  3 13:37:36 MYT 2009  root@...:/usr/obj/sys/arch/i386/compile/GENERIC i386
                  >
                  >
                  > ________________________________
                  >
                  >
                  > MARKETPLACE
                  > Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.<img width="1" height="1" alt="" src="http://us.bc.yahoo.com/b?P=7ded4cf2-1e86-11e1-9dd1-4f9355c582c2&T=1d8g9tom6%2fX%3d1323009878%2fE%3d1705006580%2fR%3dgroups%2fK%3d5%2fV%3d2.1%2fW%3dH%2fY%3dYAHOO%2fF%3d119596780%2fH%3dY29udGVudD0iR287UG9kY2FzdHM7V2lkZ2V0cztGbGlja3I7QnJpZWZjYXNlO1lhaG9vX1NlYXJjaF9NYXJrZXRpbmc7Qm9va21hcms7TW9iaWxlO0dyb3VwcztLbm93bGVkZ2VfU2VhcmNoOyIgZGlzYWJsZXNodWZmbGluZz0iMSIgc2VydmVJZD0iN2RlZDRjZjItMWU4Ni0xMWUxLTlkZDEtNGY5MzU1YzU4MmMyIiBzaXRlSWQ9IjQ0NTI1NTEiIHRTdG1wPSIxMzIzMDA5ODc4NDk4MzE1IiA-%2fQ%3d-1%2fS%3d1%2fJ%3d28228962&U=13ccg2vai%2fN%3dZTsSNtGDJGQ-%2fC%3d493064.14543979.14562481.13298430%2fD%3dMKP1%2fB%3d6060255%2fV%3d1">
                  >
                  > Switch to: Text-Only, Daily Digest • Unsubscribe • Terms of Use
                  > .
                  >
                  >
                  >
                  > [Non-text portions of this message have been removed]
                  >
                  >
                  >
                  > ------------------------------------
                  >
                  > Salam Aidilfitri kepada semua pelanggan mailing list my-penguin99.
                  >
                  >
                  > Untuk mengeluarkan diri anda dari senarai email ini, hantarkan email ke :
                  > mypenguin99-unsubscribe@yahoogroups.comYahoo! Groups Links
                  >
                  >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.