NT For command and pipe symbol in data file problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: NT For command and pipe symbol in data file problem

Hybrid View

  1. #1
    Michael Liang Guest

    NT For command and pipe symbol in data file problem


    Hi,

    I'm working on a script to replace the fifth variable in a text file. The
    problems is the | (pipe) delimiter used which the for command parse and removes
    it from the file.


    set f="delete"
    for /F "tokens=1-5 delims=|" %%i in (client.del) do @echo %%i %%j %%k %%l
    %f% >> clientowndel.txt

    This line will work but not echoing the pipe symbol that I need for the data
    import. Can I replicate the pipe symbol without using quotes which would
    corrupt the data. Any help would be appreciated.
    Share on Google+

  2. #2
    nguerm Guest

    Re: NT For command and pipe symbol in data file problem


    You have to isolate the pipe whit an anti-slash "\|"
    that's all
    Share on Google+

  3. #3
    Hansjoerg G. Henker Guest

    Re: NT For command and pipe symbol in data file problem


    "Michael Liang" <michael.liang@ny.frb.org> wrote:
    >
    >Hi,

    Hi again,

    >I'm working on a script to replace the fifth variable in a text file. The
    >problems is the | (pipe) delimiter used which the for command parse and

    removes
    >it from the file.

    I cant understand, why you dont use the semikolon - this is the standard
    of list-seperators.
    Anyway...

    >set f="delete"
    >for /F "tokens=1-5 delims=|" %%i in (client.del) do @echo %%i %%j %%k %%l
    >%f% >> clientowndel.txt

    Under W2k and NT4 (SP4) there is no prob with this ! Just I've checked this
    on both platforms.

    Input-File:
    -----------
    spalte1|spalte2|spalte3|spalte4|spalte5
    client1|client2|client3|client4|
    test1|test2|test3|test4

    Output-File:
    ------------
    spalte1 spalte2 spalte3 spalte4 "delete"
    client1 client2 client3 client4 "delete"
    test1 test2 test3 test4 "delete"

    >This line will work but not echoing the pipe symbol that I need for the

    data
    >import. Can I replicate the pipe symbol without using quotes which would
    >corrupt the data. Any help would be appreciated.


    Please send me your error-message...

    ByeBye,
    BitH...
    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center