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
Post a Comment