how to display grep pattern in perl on windows -


how grep pattern matched lines in perl

for example sample.csv

name: john location: paris 

in unix able grep this

cat sample.csv | grep name | cut -f 2 -d " " 

but need in windows

output:

john,paris 

your example sample.csv doesn't appear real csv file, limits our parsing options.

therefore, going straight regex solution, might some:

perl -nle "/^name: (.*?) location: (.*?)/ && print qq{$1, $2\n};" sample.csv 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -