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

parsing off qoutes

Expand Messages
  • johnh@fgm.com
    Hi, I have a file containing a single word surrounded by quotes. I want to get the word from the file minus the quotes and put it into a variable. This is my
    Message 1 of 6 , Feb 1, 2001
    • 0 Attachment
      Hi,
      I have a file containing a single word surrounded by quotes. I want
      to get the word from the file minus the quotes and put it into a
      variable. This is my best non-working guess:

      for /f "delims="^ tokens=1" %%a in (tmp) do set WORD=%%a

      If I do the following I can get the word but it still has the quotes:

      for /f %%a in (tmp) do set WORD=%%a

      Maybe once it is in %WORD% I could parse it from there. Any Ideas?

      Thanks,
      J
    • Michael Marquart
      On Thu, 01 Feb 2001 18:53:38 -0000 Subject: [BATCH WORLD] parsing off qoutes johnh@fgm.com wrote: This works under Win98 @echo off set test= abc for %%a in
      Message 2 of 6 , Feb 1, 2001
      • 0 Attachment
        On Thu, 01 Feb 2001 18:53:38 -0000
        Subject: [BATCH WORLD] parsing off qoutes
        johnh@... wrote:


        This works under Win98

        @echo off
        set test="abc"
        for %%a in (%test%) do set test=%%a
        echo %test%


        so I'm guessing you can replace the first set statement with:

        for /f %%a in (tmp) do set test=%%a


        Mic


        >Hi,
        >I have a file containing a single word surrounded by quotes. I want
        >to get the word from the file minus the quotes and put it into a
        >variable. This is my best non-working guess:
        >
        >for /f "delims="^ tokens=1" %%a in (tmp) do set WORD=%%a
        >
        >If I do the following I can get the word but it still has the quotes:
        >
        >for /f %%a in (tmp) do set WORD=%%a
        >
        >Maybe once it is in %WORD% I could parse it from there. Any Ideas?
        >
        >Thanks,
        >J
        >
      • James Zagorski
        Forgive me, but I am unfamiliar with the /f switch of the for command.... for /? doesn t provide me any answers as well. Could someone inform me
        Message 3 of 6 , Feb 1, 2001
        • 0 Attachment
          Forgive me, but I am unfamiliar with the /f switch of the
          for command.... for /? doesn't provide me any answers as well.

          Could someone inform me of the /f and any other for command switches.

          Thanks..


          __________________________________________________
          Get personalized email addresses from Yahoo! Mail - only $35
          a year! http://personal.mail.yahoo.com/
        • Jim Knopf
          Here s a Win9x/NT method: if %OS%/==Windows_NT/ set NTSwitch=/f tokens* for %NTSwitch% %%a in ( String enclosed in quotes ) do echo %%a HTH __ _ _ ... ___|
          Message 4 of 6 , Feb 1, 2001
          • 0 Attachment
            Here's a Win9x/NT method:

            if %OS%/==Windows_NT/ set NTSwitch=/f "tokens*"
            for %NTSwitch% %%a in ("String enclosed in quotes") do echo %%a

            HTH

            __ _ _
            |_ |_)(__ http://www.fpschultze.de
            ___| | ____)chultze_________________________________________________
            I am logged in, therefore I am.



            ----- Original Message -----
            From: "Michael Marquart" <micm@...>
            To: <batchworld@yahoogroups.com>
            Sent: Thursday, February 01, 2001 8:23 PM
            Subject: Re: [BATCH WORLD] parsing off qoutes


            > On Thu, 01 Feb 2001 18:53:38 -0000
            > Subject: [BATCH WORLD] parsing off qoutes
            > johnh@... wrote:
            >
            >
            > This works under Win98
            >
            > @echo off
            > set test="abc"
            > for %%a in (%test%) do set test=%%a
            > echo %test%
            >
            >
            > so I'm guessing you can replace the first set statement with:
            >
            > for /f %%a in (tmp) do set test=%%a
            >
            >
            > Mic
            >
            >
            > >Hi,
            > >I have a file containing a single word surrounded by quotes. I want
            > >to get the word from the file minus the quotes and put it into a
            > >variable. This is my best non-working guess:
            > >
            > >for /f "delims="^ tokens=1" %%a in (tmp) do set WORD=%%a
            > >
            > >If I do the following I can get the word but it still has the quotes:
            > >
            > >for /f %%a in (tmp) do set WORD=%%a
            > >
            > >Maybe once it is in %WORD% I could parse it from there. Any Ideas?
            > >
            > >Thanks,
            > >J
          • Jim Knopf
            The Text Parser FOR Command in NT Using the /F switch parses text line by line and then executes the interation command for each line of text. Syntax: for /f
            Message 5 of 6 , Feb 1, 2001
            • 0 Attachment
              The Text Parser FOR Command in NT

              Using the /F switch parses text line by line and then executes the
              interation command for each line of text. Syntax:

              for /f ["Options"] %v in (Source) do command

              Source can be one of the following:

              - A set of one or more text file names, sep. by spaces. (No
              wildcards!)

              - A string enclosed in double quotes

              - A command enclosed in single quotes

              Each iteration of the for /f command processes a single line of text from
              the specified source. Blank lines are skipped. Non-blan lines are first
              parsed into tokens, ie. in arbitrary blocks of text delimited by delimiter
              characters within the line. These tokens are assigned to one or more
              iterator variables (%a, %b, ...)

              Options:

              eol=c specifies c as the end-of-line command delimiter
              character

              skip=nn skips nn lines of input before starting parsing

              delims=xxx specifies xxx as the token delimiters to use when parsing
              each line

              tokens=ttt specifies which tokens to assign to iterator variables


              __ _ _
              |_ |_)(__ http://www.fpschultze.de
              ___| | ____)chultze_________________________________________________
              I am logged in, therefore I am.

              ----- Original Message -----
              From: "James Zagorski" <zgreatwhite@...>
              To: <batchworld@yahoogroups.com>
              Sent: Thursday, February 01, 2001 9:16 PM
              Subject: Re: [BATCH WORLD] parsing off qoutes


              > Forgive me, but I am unfamiliar with the /f switch of the
              > for command.... for /? doesn't provide me any answers as well.
              >
              > Could someone inform me of the /f and any other for command
              switches.
              >
              > Thanks..
            • johnh@fgm.com
              Yes that sort of works I have to do it like this: for /f %%a in (tmp) do set test=%%a for /f %%a in (%test%) do set test=%%a I also found another method that
              Message 6 of 6 , Feb 1, 2001
              • 0 Attachment
                Yes that sort of works I have to do it like this:
                for /f %%a in (tmp) do set test=%%a
                for /f %%a in (%test%) do set test=%%a

                I also found another method that works once I have it in a variable:
                set test=%test:"=%

                Thanks for your help.
                J

                --- In batchworld@y..., Michael Marquart <micm@m...> wrote:
                > On Thu, 01 Feb 2001 18:53:38 -0000
                > Subject: [BATCH WORLD] parsing off qoutes
                > johnh@f... wrote:
                >
                >
                > This works under Win98
                >
                > @echo off
                > set test="abc"
                > for %%a in (%test%) do set test=%%a
                > echo %test%
                >
                >
                > so I'm guessing you can replace the first set statement with:
                >
                > for /f %%a in (tmp) do set test=%%a
                >
                >
                > Mic
                >
                >
                > >Hi,
                > >I have a file containing a single word surrounded by quotes. I
                want
                > >to get the word from the file minus the quotes and put it into a
                > >variable. This is my best non-working guess:
                > >
                > >for /f "delims="^ tokens=1" %%a in (tmp) do set WORD=%%a
                > >
                > >If I do the following I can get the word but it still has the
                quotes:
                > >
                > >for /f %%a in (tmp) do set WORD=%%a
                > >
                > >Maybe once it is in %WORD% I could parse it from there. Any Ideas?
                > >
                > >Thanks,
                > >J
                > >
              Your message has been successfully submitted and would be delivered to recipients shortly.