I have a text variable of class text that shows something like this when it is returned:  " This is sentence 1. This is sentence 2. This is sentence 3. This is sentence 4."   I want to be able to delete specific lines from the text, without affecting the rest of the variable:  For example: delete {1, 3} to get this result:  "This is sentence 1. This is sentence 3. This is sentence 4."
122948
I have a text variable of class text that shows something like this when it is returned:  " This is sentence 1. This is sentence 2. This is sentence 3. This is sentence 4."   I want to be able to delete specific lines from the text, without affecting the rest of the variable.  For example: delete {1, 3} to get this result:  "This is sentence 1. This is sentence 3. This is sentence 4."     The method described in this answer has a serious bug:    The linked method to delete lines in a paragraph actually converts all linefeeds in the text variable to returns. In other words, it is impossible to run this code more than once on the same variable.  For example, the following code:  set varText to " This is sentence 1. This is sentence 2. This is sentence 3. This is sentence 4." set varText to do shell script "sed -e '1d;3d' &lt;&lt;&lt; " &amp; quoted form of varText -- Employing the same method on the same variable: set varText to do shell script "sed -e '1d;3d' &lt;&lt;&lt; " &amp; quoted form of varText return varText   returns  ""  Since this method only works correctly if the lines of the text variable are the product of a linefeed (as it should), the problem is not that this method fails to perceive a return as a new line (as I had originally claimed in this question). The problem is that this code introduces a return to the text variable in the first place.    Thus, I want a solution that will allow me to run the same text variable through the solution more than once in the same AppleScript.  In other words, I am looking for a method to remove a specific line from a paragraph that does not have this bug and does not insert a return anywhere in the text.
116435
I have a text file that looks like his:  #c1     c2              c3              c4              c5              c6      c7      c8      c9      c10     c11     c12     c13 4599    995,274 2523,658        264,1417170     -33,6000        -0,3600 0,0202  0,0069  0,0227  10,1041 0,0169  0,2817  0,0239 6173    1552,290        1595,696        264,0603912     -33,4880        0,4374  0,0287  1,8123  0,0385  10,1289 0,0292  2,8445  0,0366 6456    1658,630        1529,292        264,0449377     -33,4800        0,0109  0,0234  1,0955  0,0296  10,5032 0,0223  1,7168  0,0293 8932    2750,029        1374,395        263,8866195     -33,4615        -0,3185 0,0249  0,9196  0,0302  10,5858 0,0221  1,3886  0,0296 4095    820,716 495,315 264,1658451     -33,3546        -0,4388 0,0216  0,6497  0,0252  10,6026 0,0188  1,1796  0,0258 4737    1045,289        1395,983        264,1338240     -33,4636        0,5900  0,0231  0,8853  0,0273  10,6501 0,0204  1,1661  0,0270   ie: not aligned at certain random lines (the file is ~10000 lines long) I need it to look like this:  #c1     c2              c3              c4              c5              c6      c7      c8      c9      c10     c11     c12     c13 4599    995,274         2523,658        264,1417170     -33,6000        -0,3600 0,0202  0,0069  0,0227  10,1041 0,0169  0,2817  0,0239 6173    1552,290        1595,696        264,0603912     -33,4880        0,4374  0,0287  1,8123  0,0385  10,1289 0,0292  2,8445  0,0366 6456    1658,630        1529,292        264,0449377     -33,4800        0,0109  0,0234  1,0955  0,0296  10,5032 0,0223  1,7168  0,0293 8932    2750,029        1374,395        263,8866195     -33,4615        -0,3185 0,0249  0,9196  0,0302  10,5858 0,0221  1,3886  0,0296 4095    820,716         495,315         264,1658451     -33,3546        -0,4388 0,0216  0,6497  0,0252  10,6026 0,0188  1,1796  0,0258 4737    1045,289        1395,983        264,1338240     -33,4636        0,5900  0,0231  0,8853  0,0273  10,6501 0,0204  1,1661  0,0270   So basically I'm looking for a script/command line utility to automatically align the columns of the file.
93119
I am trying to delete certain text that appears before / on every line.   I have something like:  testing.db.com/7fad416d-f2b3-4259-b98d-2449957a3123 testing.db.com/8a8589bf-49e3-4cd7-af15-6753067355c6   and I just want to end up with:   7fad416d-f2b3-4259-b98d-2449957a3123 8a8589bf-49e3-4cd7-af15-6753067355c6    Can anyone help me with a regular expression? Everything I have found is deleting after /, not before.
71374
I have a file with a list of emails in it and each line has an email in it. I want to remove lines that contain the string example.com or test.com.  I tried this:   sed -i 's/example\.com//ig' file.txt    But it will remove only the string example.com, how can I remove the entire line?
107749
In vim I can delete all lines that contain the word "price" with this  :g /price/d   How can I delete all lines that do NOT contain the word "price"?
65160
I know that for a mesh you can go into edit mode and select vertices and assign a specific material to them quite easily. I want to know if it is possible to do this with a Text object (which has no vertices).
60900
Using Vim I often want to replace a block of code with a block that I just yanked.  But when I delete the block of code that is to be replaced, that block itself goes into the register which erases the block I just yanked. So I've got in the habit of yanking, then inserting, then deleting what I didn't want, but with large blocks of code this gets messy trying to keep the inserted block and the block to delete separate.  So what is the slickest and quickest way to replace text in Vim?   is there a way to delete text without putting it into the register? is there a way to say e.g. "replace next word" or "replace up to next paragraph" or is the best way to somehow use the multi-register feature?
76287
I'm looking for a field calculator Python statement to delete only the first two letters of string entries. For Ex:  !Name!.strip([0:2])   I know this syntax is incorrect.
45384
If I use cat -n text.txt to automatically number the lines, how do I then use the command to show only certain numbered lines.
51757
I'm stuck on how I can go about deleting lines that are newer than given date. Here is a snippet of contents of a file.  buildsave.txt  647919 2013/11/30 647946 2013/11/30 647955 2013/12/01 648266 2013/12/03 648267 2013/12/03 648674 2013/12/04   I would like to remove the lines that are newer than 2013/12/03 leaving only  647919 2013/11/30 647946 2013/11/30 647955 2013/12/01   How can this be done through bash?
26992
I have this file:  sometext1{ string1 }  sometext2{ string2 string3 }  sometext3{ string4 string5 string6 }   I want to search this file for a specific string and print everything before this string up to the opening { and everything after this string up to the closing }. I tried to achieve this with sed but if I try to print everything in the range /{/,/string2/ for example sed prints this:  sometext1{ string1 }  sometext2{ string2 sometext3{ string4 string5 string6 }   If I search for the string "string2" I need the output to be:   sometext2{ string2 string3 }   Thanks.
34396
I have a poem with an unknown number of rows and I want to display only the penultimate one. What command should I use?
43996
I am writing a text which I will review later again and want to comment out only a part of a line (in between), something like this:  Once upon a time, there was %in some galaxy far away% a nice and cute rabbit...   When I review it again, I could decide if it is better to include that part or not.   Is it possible to do such a thing?
33335
I can select all file by going to the 1st line Alt+\, start marking the text by Alt+A, go to the last line by Alt+/  But there, I don't know which key to remove the selected text. Hit delete doesn't work for me but Ctrl+K to cut the text will destroy my clipboard.  So, what is the hotkey to delete selected text?
10097
Does Java have a built-in way to escape arbitrary text so that it can be included in a regular expression? For example, if my users enter "$5", I'd like to match that exactly rather than a "5" after the end of input.
10572
Given an array of n Objects, let's say it is an array of strings, and it has the following values:  foo[0] = "a"; foo[1] = "cc"; foo[2] = "a"; foo[3] = "dd";   What do I have to do to delete/remove all the strings/objects equal to "a" in the array?
63162
Let's say:  &lt;div&gt;   pre text   &lt;div class="remove-just-this"&gt;     &lt;p&gt;child foo&lt;/p&gt;     &lt;p&gt;child bar&lt;/p&gt;     nested text   &lt;/div&gt;   post text &lt;/div&gt;   to this:  &lt;div&gt;   pre text   &lt;p&gt;child foo&lt;/p&gt;   &lt;p&gt;child bar&lt;/p&gt;   nested text   post text &lt;/div&gt;   I've been figuring out using Mootools, jQuery and even (raw) JavaScript, but couldn't get the idea how to do this.