Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Deleting multiple lines
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gregjsmith  
View profile  
 More options Mar 13 2009, 4:44 pm
From: gregjsmith <gregory.j.sm...@gmail.com>
Date: Fri, 13 Mar 2009 13:44:18 -0700 (PDT)
Local: Fri, Mar 13 2009 4:44 pm
Subject: Deleting multiple lines
How do I go about deleting lines X through Y in TextWrangler? I don't
want to have to manually select them because there are like 10,000
lines.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Woolsey  
View profile  
 More options Mar 13 2009, 5:39 pm
From: Patrick Woolsey <pwool...@barebones.com>
Date: Fri, 13 Mar 2009 17:39:14 -0400
Local: Fri, Mar 13 2009 5:39 pm
Subject: Re: Deleting multiple lines
gregjsmith <gregory.j.sm...@gmail.com> sez:

>How do I go about deleting lines X through Y in TextWrangler? I don't
>want to have to manually select them because there are like 10,000
>lines.

Depending on how those lines are delimited, there may be other ways to do
this (e.g. a search with "Extend Selection"), but the basic procedure is:

* turn on "Show Line Numbers" via the Text Options popup, or Edit -> Text
Options

* scroll to line X

* set the insertion point at the start of line X

* scroll until line Y is in view

* Shift-click at the beginning of line Y+1 (which will select everything
from line X to that point)

and press Delete. :-)

Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.                        <http://www.barebones.com>
P.O. Box 1048, Bedford, MA 01730-1048


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Derek Neil  
View profile  
 More options Nov 4 2012, 8:56 am
From: Derek Neil <krazyde...@gmail.com>
Date: Sun, 4 Nov 2012 05:56:50 -0800 (PST)
Local: Sun, Nov 4 2012 8:56 am
Subject: Re: Deleting multiple lines

THANK YOU!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve  
View profile  
 More options Nov 4 2012, 1:04 pm
From: Steve <online...@gmail.com>
Date: Sun, 4 Nov 2012 10:04:48 -0800 (PST)
Local: Sun, Nov 4 2012 1:04 pm
Subject: Re: Deleting multiple lines

An alternate "cheating" method could also be this (turn 'grep' on):

Search:  \A((?:.*\r){50})(?:.*\r){20}
Replace: \1

\A matches the very top of the document.

(  (?:.*\r){50}   )    has a matching group and a non-matching group. The
non-matching group contains "everything up to a newline character" which is
then repeated 50 times.  The outer "matching" group will store all 50 lines
that were just captured so we can stick it back into the "\1" replacement.

(?:.*\r){20}    is another non-matching group of 20 lines. You plan to
delete these lines, so there is no reason to "capture" them (the construct
of (?: ... ) means not to "collect" the text in it).

So if you have exactly 200 lines that you want to save at the top of the
document, then 10,000 lines after that which you want to remove, simply
adjust your {50} and {20} respectively, and you're good to go.  :-)

-Steve


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Stone  
View profile  
 More options Nov 4 2012, 5:14 pm
From: Christopher Stone <listmeis...@suddenlink.net>
Date: Sun, 4 Nov 2012 16:14:38 -0600
Local: Sun, Nov 4 2012 5:14 pm
Subject: Re: Deleting multiple lines

On Nov 04, 2012, at 07:56, Derek Neil <krazyde...@gmail.com> wrote:

> THANK YOU!

> On Friday, 13 March 2009 18:39:14 UTC-3, Patrick Woolsey wrote:
>> Depending on how those lines are delimited, there may be other ways to do this (e.g. a search with "Extend Selection"), but the basic procedure is:

______________________________________________________________________

Hey Derek,

It's easy enough to delete a contiguous range of lines.

This script expects input in the form of '10:20' (no quotes) — where the first number is the start-line and the second number is the end-line of the range.

You can change the default answer to whatever you'd like.

--
Best Regards,
Chris

--------------------------------------------------------------------------- ----------------

try

  set delRng to text returned of ¬
    (display dialog "Enter Range of Lines to Delete:" default answer "1:100" giving up after 60)
  set AppleScript's text item delimiters to ":"
  set delRng to text items of delRng
  if length of delRng = 2 then
    set {startRng, endRng} to text items of delRng
    tell application "TextWrangler"
      tell front text window
        delete (lines startRng thru endRng)
      end tell
    end tell
  end if

on error e number n
  set e to e & return & return & "Num: " & n
  tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
  if button returned of dDlg = "Copy" then set the clipboard to e
end try

--------------------------------------------------------------------------- ----------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »