Shortcuts in Science
Monday, 19 June 2017
Regular Expression
VAR=';[^_]+_'
if [[
$A =~ $VAR
]]; then
OUT=`echo $A | perl -pe 's|(.+);.+(_[^_]+)$|\1\2|g'`;
elif [[ $A =~ ';' ]]; then
OUT=`echo $A | perl -pe 's|;|_|g'`;
else
OUT=$A
fi
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment