cut a string in file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • June Lee

    cut a string in file

    I have a big text file (about 10MB)

    is there fast way to delete the string

    xmlns='urn:TMSW ebServices'

    from the file quick?

    the string will be some where in the first 20 line of the big text
    file.
  • Ian Collins

    #2
    Re: cut a string in file

    June Lee wrote:
    I have a big text file (about 10MB)
    >
    is there fast way to delete the string
    >
    xmlns='urn:TMSW ebServices'
    >
    from the file quick?
    >
    the string will be some where in the first 20 line of the big text
    file.
    Use a command line stream editor like sed.

    --
    Ian Collins.

    Comment

    • June Lee

      #3
      Re: cut a string in file

      Any way do in C++?
      >Use a command line stream editor like sed.

      Comment

      • Ian Collins

        #4
        Re: cut a string in file

        June Lee wrote:

        [please don't top-post]
        >
        >Use a command line stream editor like sed.
        Any way do in C++?
        Well yes, but why bother?

        You could just read the file line by line and search/replace the string
        in each line.

        --
        Ian Collins.

        Comment

        • Default User

          #5
          Re: cut a string in file

          June Lee wrote:
          I have a big text file (about 10MB)
          >
          is there fast way to delete the string
          >
          xmlns='urn:TMSW ebServices'
          >
          from the file quick?
          >
          the string will be some where in the first 20 line of the big text
          file.

          There are no standard file operations for deleting part of a file (and
          frequently no extensions for that sort of thing). The usual way is to
          create a temporary file, and rewrite it without the missing text, then
          copy the temp over the old file.



          Brian

          Comment

          Working...