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

Re: [BATCH WORLD] cut first four lines

Expand Messages
  • Raja Sekhar
    Hi thanks for u r reply.But what i wanted to do something like this ... @echo off igrep %1 found.txt notepad found.txt this gives me the below in the
    Message 1 of 4 , Apr 14, 2001
    • 0 Attachment
      Hi
      thanks for u'r reply.But what i wanted to do something like this
      ::search.bat
      @echo off
      igrep %1
      >found.txt
      notepad found.txt
       
      this gives me the below in the found.txt
      ********************************************************************************
      IGREP(C) CopyLeft Bill Buckels 1994-2000. All Rights Reversed.
      File spec   = *.*
      Search spec = abc
       
      raja.txt.txt
        4         :abc 12345 12732 abc@...
      ***************************************************************************
      But i want only the last line of it Displayed in the found.txt so my found.txt should be
       
      ***************************************************************************
      :abc 12345 12732 abc@...
       
      ***************************************************************************
      Thanks
      Raja
       
       
      ----- Original Message -----
      Sent: Saturday, April 14, 2001 9:45 PM
      Subject: Re: [BATCH WORLD] cut first four lines

      >hello
      >i need to display only the fifth line of the text file as the output.for
      >example c:\ igrep raja >found.txt  gives the following
      >*IGREP(C) CopyLeft Bill Buckels 1994-2000. All *Rights Reversed.
      >*File spec   = *.*
      >*Search spec = raja
      >*
      >*search.bat
      >* 1         :igrep raja >found.txt
      >*raja.txt.txt
      >*  1         :raja 123 935 --- 3628806
      >but i need only the last line(8th line) as output in the text file and also

      ::search.bat
      @echo off
      igrep %1 |find "*  1">%1.txt
      notepad %1.txt

      The key here is what appears ONLY on the desired line which you place into the
      FIND search spec.  Above I used the first 4 characters of the target line.

      %1 will be replaced with the term after the batchfile name, on the command
      line.

      Michael

      >
      >i need the abc part as user input like i can type search.bat %xxx% or
      >search.bat %something%
      >any help ??
      >thanks
      >Raja



      To Post a message, send it to:   batchworld@...

      To Unsubscribe, send a blank message to: batchworld-unsubscribe@...


      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    • Michael Marquart
      ... You get the entire line, find cannot return a portion of a line. so it will return 4 :abc 12345 12732 abc@abc.com Try this - it looks for a space
      Message 2 of 4 , Apr 14, 2001
      • 0 Attachment
        >thanks for u'r reply.But what i wanted to do something like this
        >::search.bat
        >@echo off
        >igrep %1 >found.txt
        >notepad found.txt
        >
        >this gives me the below in the found.txt
        >********************************************************************************
        >IGREP(C) CopyLeft Bill Buckels 1994-2000. All Rights Reversed.
        >File spec = *.*
        >Search spec = abc
        >
        >raja.txt.txt
        > 4 :abc 12345 12732 abc@...
        >***************************************************************************
        >But i want only the last line of it Displayed in the found.txt so my found.txt should be
        >
        >***************************************************************************
        >:abc 12345 12732 abc@...
        >
        >***************************************************************************

        You get the entire line, find cannot return a portion of a line.
        so it will return
        4 :abc 12345 12732 abc@...


        Try this - it looks for a space followed by a : followed by the search term
        and then another space.


        ::search.bat
        @echo off
        igrep %1 |find " :%1 ">found.txt
        notepad found.txt


        Michael

        >Thanks
        >Raja
        >
        >
        > ----- Original Message -----
        > From: Michael Marquart
        > To: batchworld@yahoogroups.com
        > Sent: Saturday, April 14, 2001 9:45 PM
        > Subject: Re: [BATCH WORLD] cut first four lines
        >
        >
        > >hello
        > >i need to display only the fifth line of the text file as the output.for
        > >example c:\ igrep raja >found.txt gives the following
        > >*IGREP(C) CopyLeft Bill Buckels 1994-2000. All *Rights Reversed.
        > >*File spec = *.*
        > >*Search spec = raja
        > >*
        > >*search.bat
        > >* 1 :igrep raja >found.txt
        > >*raja.txt.txt
        > >* 1 :raja 123 935 --- 3628806
        > >but i need only the last line(8th line) as output in the text file and also
        >
        > ::search.bat
        > @echo off
        > igrep %1 |find "* 1">%1.txt
        > notepad %1.txt
        >
        > The key here is what appears ONLY on the desired line which you place into the
        > FIND search spec. Above I used the first 4 characters of the target line.
        >
        > %1 will be replaced with the term after the batchfile name, on the command
        > line.
        >
        > Michael
        >
        > >
        > >i need the abc part as user input like i can type search.bat %xxx% or
        > >search.bat %something%
        > >any help ??
        > >thanks
        > >Raja
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.