Answer the question
In order to leave comments, you need to log in
What is the easiest and fastest way to parse this file?
Good afternoon,
tell me the easiest way to parse this file on bash
xxx:[<b>yyyyy1</b>] yyy:[xxxx]
xxx:[<b>yyyyy2</b>] yyy:[xxxx]
....
Answer the question
In order to leave comments, you need to log in
grep/sed
$ printf "xxx:[<b>yyyyy1</b>] yyy:[xxxx]\nxxx:[<b>yyyyy2</b>] yyy:[xxxx]" | grep -oE '<b>+</b>' | sed -E 's/<\/?b>//g'
yyyyy1
yyyyy2
$ printf "xxx:[<b>yyyyy1</b>] yyy:[xxxx]\nxxx:[<b>yyyyy2</b>] yyy:[xxxx]" | perl -e 'while(<>){ if ($_ =~ m/<b>(.*)<\/b>/){ print $1."\n"; } }'
yyyyy1
yyyyy2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question