Author Topic: Is it possible to execute shell commands directly on buffer contents?  (Read 5097 times)

Steve_L

  • Community Member
  • Posts: 6
  • Hero Points: 0
CodeWright had a feature where you could execute a shell command directly on the contents of a buffer without requiring a command shell to be opened.  Does SlickEdit have a comparable feature?

Thanks.

jimlangrunner

  • Senior Community Member
  • Posts: 360
  • Hero Points: 31
  • Jim Lang - always a student.
Re: Is it possible to execute shell commands directly on buffer contents?
« Reply #1 on: January 27, 2010, 11:39:54 pm »
two commands that I found were
launch-os-shell (launches a command prompt for your OS)
and
shell-command
which runs an OS command and puts the results in a buffer
For instance, shell-command followed by dir c:\fred
gets me a directory listing of C:\Fred in a buffer.  For me, it opens a new buffer (temporary) with the results.

Is that what you're looking for?

Steve_L

  • Community Member
  • Posts: 6
  • Hero Points: 0
Re: Is it possible to execute shell commands directly on buffer contents?
« Reply #2 on: January 28, 2010, 03:14:38 am »
Here is an example of what I am trying to do:

Let's say I copy a large amount of text into a buffer and I want to weed out all duplicate lines.  I would use this feature to sort the data in the buffer by executing sort.exe, followed by removing duplicates from the buffer using uniq.exe.

In CodeWright, their feature appeared to feed the contents of the buffer to the executed shell command followed by replacing the contents of the buffer with the output of the shell command.

Hope this helps.

Thanks for your help.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Is it possible to execute shell commands directly on buffer contents?
« Reply #3 on: January 28, 2010, 01:21:20 pm »
There is a command that works on selections, under Edit > Other > Filter Selection... (or filter-command on the SlickEdit command-line).  You will be prompted for the command (example: sort | uniq) and the selection act as the stdin and the selection willl be replaced with the results of the command.

Steve_L

  • Community Member
  • Posts: 6
  • Hero Points: 0
Re: Is it possible to execute shell commands directly on buffer contents?
« Reply #4 on: January 28, 2010, 03:30:05 pm »
This is exactly what I was looking for.

Thanks Lee.

jporkkahtc

  • Senior Community Member
  • Posts: 1902
  • Hero Points: 184
  • Text
OK, so I'm sick of the pathetic built-in sort command so I finally went looking for this filter capability.
filter_command doesn't always replace -- it sometimes inserts the results.

Repro:
In a CMD.exe window, enter a filter command (like grep, sort, whatever) to test out what you are about to do in slick :-)
Copy that command to the clipboard.

In slickedit select some text to be filtered.
Edit->Other->Filter.
PASTE the command into the edit box.
Hit OK.

The filtered text is inserted after the cursor and the original text is left in place.
More: The selection is extended to cover the original text, the inserted text plus one additional line.


Graeme

  • Senior Community Member
  • Posts: 2445
  • Hero Points: 322
OK, so I'm sick of the pathetic built-in sort command so I finally went looking for this filter capability.
filter_command doesn't always replace -- it sometimes inserts the results.

Repro:
In a CMD.exe window, enter a filter command (like grep, sort, whatever) to test out what you are about to do in slick :-)
Copy that command to the clipboard.

In slickedit select some text to be filtered.
Edit->Other->Filter.
PASTE the command into the edit box.
Hit OK.

The filtered text is inserted after the cursor and the original text is left in place.
More: The selection is extended to cover the original text, the inserted text plus one additional line.

If this is a bug report, you really need to report it to slick support to be sure it's noticed.