Author Topic: Losing some of my output with filter_command(..)  (Read 5036 times)

flethuseo

  • Senior Community Member
  • Posts: 177
  • Hero Points: 2
Losing some of my output with filter_command(..)
« on: December 25, 2015, 03:45:08 AM »
When I run the following command I am losing the first 3 spaces I am intentionally adding for indentation. I'm thinking filter_command is doing more than just printing out the result of my selection. I want the 3 spaces I added before the first column!

Also I want to change this command to execute on whatever is on my clipboard instead of a selection, is there a way to get an equivalent of it, running "gawk '{ print "   "$1 }'" on each line of text on the clipboard?

Code: [Select]
_command void get_first_col() {

   if (_select_type() == "") {
      select_all()
   } else if (_select_type() != "LINE" && _select_type() != "BLOCK") {
      // Convert it into a LINE selection
      _select_type('', 'T', 'LINE');
   }
   _str out = filter_command("gawk '{ print "   "$1 }'");
}

To run this macro, copy paste a tab sepparated table, select it on SlickEdit, and execute the command. It should cut out the first column.

Ted


Nhulbutv

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Losing some of my output with filter_command
« Reply #1 on: March 07, 2016, 05:07:16 PM »
Is it possible to execute HF via a command line call?  We want to call it as part of a workflow and pass parameters for e.g. the folders, location etc.

Cheers

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6990
  • Hero Points: 533
Re: Losing some of my output with filter_command(..)
« Reply #2 on: March 08, 2016, 11:54:44 AM »
When I run the following command I am losing the first 3 spaces I am intentionally adding for indentation. I'm thinking filter_command is doing more than just printing out the result of my selection. I want the 3 spaces I added before the first column!

I wrote a small program which outputs leading spaces and tried the filter_command function on it. The leading spaces were inserted.  I also took a look at the implementation of filter_command and it just does a get() on the resulting file which definitely doesn't strip leading spaces. Something else must be going on.