Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Gordom,

Below, Miroslaw mentioned grep. In Linux, you can achieve your goal by typing something like the following:

    grep --extended-regexp "^Set" input.txt > output.txt

This gets the lines in input.txt that start with "Set" and writes these lines to output.txt.

You might not even have to type the "--extended-regexp" part.

Winston

On 01/08/2013 05:38 PM, Mirosław Zalewski wrote:
Although you have solved your problem already by other means, but let's check
other possibilities.

On 08/01/2013 at 21:45, gordom <gordom1@wp.pl> wrote:

In "real" life :-) there are lines starting with letters also. Only
these with "Set:" at the beginning should be left, rest is going to be
deleted.
By looking at this sample, I see three more patterns that could get work done.
1. It seems that only lower-case letters are in "Set", which is in lines you
want preserve. So maybe looking for lines containing only numbers and upper-
case letters will do the trick.
2. In this sample, spaces are only in lines you want to preserve. What about
matching lines without whitespace characters?
3. It looks like colon happens only in lines you want to delete. Match lines
without colons, maybe?

I'm surprised that there is no simple way to find everything except
"Set:.+$"
Well, regexps are most often used in programming languages or tools like grep,
where you can easily get "reverse match" mode (print everything that does NOT
match). But LO is not programming language and it's simple regexp engine is
simply not sophisticated enough in many cases.

I have read somewhere on TDF wiki about incorporating mature regexp library in
LO, but this idea was rejected due to portability issues. LO must run on
Windows and OS X as well as on Linux, whereas library in question runs only on
Linux.


--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.