Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8875209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:55:07+00:00 2026-06-14T18:55:07+00:00

I try to write a script which takes in params: range of line range

  • 0

I try to write a script which takes in params:

  • range of line
  • range of column

For ex: cmd filename 1 5 12 87
where 1 and 5 it’s range of line
and 12 and 87 range of column

I want to extract text from these ranges.

I find something for line using head and tail but I have no idea on how i can select the corresponding columns.

Only for windows: batch, powershell.


UPDATE 1

file.txt

define('HTTP_REQUEST_METHOD_GET',     'GET',     true);
define('HTTP_REQUEST_METHOD_HEAD',    'HEAD',    true);
define('HTTP_REQUEST_METHOD_POST',    'POST',    true);
define('HTTP_REQUEST_METHOD_PUT',     'PUT',     true);
define('HTTP_REQUEST_METHOD_DELETE',  'DELETE',  true);
define('HTTP_REQUEST_METHOD_OPTIONS', 'OPTIONS', true);
define('HTTP_REQUEST_METHOD_TRACE',   'TRACE',   true);

cmd file.txt 1 3 19 27

output:

                  ST_METHOD_GET',     'GET',     true);
define('HTTP_REQUEST_METHOD_HEAD',    'HEAD',    true);
define('HTTP_REQUEST_METHO

I add blank a first line just for better representation.

I fact the script simulate the selection of the text from line X to line Y starting at column W (just for the first line) and eding at column Z (just for the last line)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:55:08+00:00Added an answer on June 14, 2026 at 6:55 pm

    Try this:

    Function SelectTextRange( $path, $SL, $EL, $SS , $ES)
    {
      $txt = gc $path
      $txt | select -First (($EL+1)-$SL) -Skip ($SL-1) |
         % { $_.substring( ($SS-1) ,($ES-$SS+1) )}
    }
    

    I understand that columns and lines values are included values.

    After your more accurate sample try this:

    Function SelectTextRange( $path, $SL, $EL, $SS , $ES)
    {
      $txt = gc $path
      $c = 0
      $txt[($sl+1)..($el+1)] | % { 
    
      if ($c -eq 0) { $_.substring($ss-1) } 
      if ($c -gt 0 -and $c -lt $txt[$sl..$el].count ) { $_}
      if ($c -eq ($txt[$sl..$el].count) ) { $_.substring(0,$es+1) } ;
    
      $c++
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to write a script to scp a file from local server A
I am new to python and try to write a script which makes byte
I want to write a script which checks and opens a settings-file called .mysettings
i want a write a php script which can start , stop , enable
I am try to write some validation script using javascript and prototype. What I
I try to write a simple user script to enlarge the picture when you
i'm using google gadget to write a short script and try to insert to
try to write a composite component that allows mutltiple text inputs. I read that
Hey I try to write a littel bash script. This should copy a dir
I wrote a script in php which reads two files and takes all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.