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

Re: passing input to a filter

Expand Messages
  • Jorge Almeida
    ... (1) was what I wanted, but (2) is handy too. I knew about (3). I suppose (1) doesn t work with other registers besides % ? Thanks for your reply. Jorge
    Message 1 of 6 , May 1 11:03 AM
      On Sat, 1 May 2004, Jacob Lerner wrote:
      >
      > The answer depends on exactly what do you want to do:
      > - Do you want to send the filename to STDIN,
      > or the contents of the current buffer ?
      > - Do you want to substitute the contents of the buffer with
      > result of the filter, or not ?
      >
      > Anyway:
      > (1) if you want to send current filename as STDIN to some
      > shell command:
      > :!echo %|mycommand
      >
      > (2) If you want to send the contents of current buffer to shell command
      > without modifying the buffer contents:
      >
      > :%w !my_command
      > :w !my_command
      >
      > (3) If you want to pipe contsnts of current buffer and
      > replace the contents with the fileter's STDOUT, then:
      >
      > :%! my_command
      >
      (1) was what I wanted, but (2) is handy too. I knew about (3).
      I suppose (1) doesn't work with other registers besides % ?
      Thanks for your reply.

      Jorge
    • Gumnos (Tim Chase)
      ... [snip] ... Well, you can always build your favorite command up using the exec command, so that you have something like ... if the former doesn t work.
      Message 2 of 6 , May 1 11:18 AM
        > > (1) if you want to send current filename as STDIN to some
        > > shell command:
        > > :!echo %|mycommand
        [snip]
        > (1) was what I wanted, but (2) is handy too. I knew about (3).
        > I suppose (1) doesn't work with other registers besides % ?

        Well, you can always build your favorite command up using the "exec"
        command, so that you have something like

        :exec ":!echo ".@a." |mycommand"

        if the former doesn't work. Additionally, you can open a new buffer, paste
        the contents you want to pass to stdin of "mycommand", and do a

        :%!mycommand

        which will convert the contents of the buffer from the input to the output.

        Just a few more ideas,

        -tim
      • Karthikeyan Ramnath
        ... or you could just select the range you want to filter, and do a :range! to pass the selected lines through the filter.. karthikeyan.r DISCLAIMER: This
        Message 3 of 6 , May 4 9:53 PM
          > Well, you can always build your favorite command up using the "exec"
          > command, so that you have something like
          >
          > :exec ":!echo ".@a." |mycommand"
          >
          > if the former doesn't work. Additionally, you can open a new
          > buffer, paste
          > the contents you want to pass to stdin of "mycommand", and do a
          >
          > :%!mycommand
          >
          > which will convert the contents of the buffer from the input
          > to the output.
          or you could just select the range you want to filter, and do a :range! to
          pass the selected lines through the filter..
          karthikeyan.r


          DISCLAIMER: This email is bound by the terms and conditions described at
          http://www.subexgroup.com/mail-disclaimer.htm
        • Jorge Almeida
          ... Thanks for the replies, Karthikeyan and Tim. Jorge
          Message 4 of 6 , May 5 6:51 AM
            On Wed, 5 May 2004, Karthikeyan Ramnath wrote:

            >
            > > Well, you can always build your favorite command up using the "exec"
            > > command, so that you have something like
            > >
            > > :exec ":!echo ".@a." |mycommand"
            > >
            > > if the former doesn't work. Additionally, you can open a new
            > > buffer, paste
            > > the contents you want to pass to stdin of "mycommand", and do a
            > >
            > > :%!mycommand
            > >
            > > which will convert the contents of the buffer from the input
            > > to the output.
            > or you could just select the range you want to filter, and do a :range! to
            > pass the selected lines through the filter..
            > karthikeyan.r
            >
            Thanks for the replies, Karthikeyan and Tim.
            Jorge
          Your message has been successfully submitted and would be delivered to recipients shortly.