bash - Sed into Variable not working properly -
i trying strip except letters , delete letters less 3 characters in bash script... got delete words has 3 characters, other rules not applied. here's i'm using:
name="the man u.n.c.l.e. official 2 2015 henry cavill armie hammer spy movie hd" keyword="$(sed -e 's/ [a-za-z]\{3\} / /g' <<< "$name")"
desired output is
echo $keyword
shows
the man official henry cavill armie hammer spy movie
any kind of can on appreciated!
try gnu sed:
name="the man u.n.c.l.e. official 2 2015 henry cavill armie hammer spy movie hd" keyword="$(sed -e 's/\b(.{1,2}|[0-9]+)\b/ /g;s/ +/ /g' <<< $name)" echo "${keyword% }"
output:
man official henry cavill armie hammer spy movie
Comments
Post a Comment