From: C.DeRykus on 30 Jun 2010 01:07 On Jun 29, 3:42 am, Sooraj S <soorajspadmanab...(a)gmail.com> wrote: > Hi, > > My data file : > ------------------- > // abc def > // > // abc dser > // > ---------------------- > i want to remove the lines 2 and 4 from the file. > > check criteria : line should start with // and one or more spaces only > as the other characters. > > i tried this .. if (/^\/\/(\s)*/ ... but it shows entire lines.. > > How to do it using regular expressions ? Is there any way to find the > end of a word using regular expressions ? If non-whitespace is the secondary criterion for validity: print if m{^ // \s+ (?=.*?\S) }x; # plenken/klempen frei -- Charles DeRykus
From: C.DeRykus on 30 Jun 2010 02:20 On Jun 29, 10:07 pm, "C.DeRykus" <dery...(a)gmail.com> wrote: > On Jun 29, 3:42 am, Sooraj S <soorajspadmanab...(a)gmail.com> wrote: > > > > > Hi, > > > My data file : > > ------------------- > > // abc def > > // > > // abc dser > > // > > ---------------------- > > i want to remove the lines 2 and 4 from the file. > > > check criteria : line should start with // and one or more spaces only > > as the other characters. > > > i tried this .. if (/^\/\/(\s)*/ ... but it shows entire lines.. > > > How to do it using regular expressions ? Is there any way to find the > > end of a word using regular expressions ? > > If non-whitespace is the secondary criterion for validity: > > print if m{^ // \s+ (?=.*?\S) }x; # plenken/klempen frei > or lookahead free too: print if m{^ // \s+ \S }x; -- Charles DeRykus
First
|
Prev
|
Pages: 1 2 Prev: FAQ 5.30 How can I read in a file by paragraphs? Next: FAQ 6.10 What is "/o" really for? |