CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [gevni] Problem in regular expression!!: Edit Log



BillKSmith
Veteran

May 21, 2013, 7:35 PM


Views: 1093
Re: [gevni] Problem in regular expression!!

Or use a one-liner.

Code
perl -pe"$_='' unless /^[^,]java/" my_file.csv >new.csv



Corrected regexp. Should be:


Code
perl -pe"$_='' unless /^[^,]*java/" my_file.csv >new.csv


This is the windows version (double quotes around the code. Two single quotes after the equal sign). Reverse single and double quotes on UNIX.

Note: The regexp matches java before the first comma.
Good Luck,
Bill

(This post was edited by BillKSmith on May 22, 2013, 9:51 AM)


Edit Log:
Post edited by BillKSmith (Veteran) on May 22, 2013, 9:51 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives