I would like to search for the following regex: "[ag][ag]aag[acg]" and transform only the whole match to uppercase but not individual search for a or g. i tried sed 'y/[ag][ag]aag[acg]/[AG][AG]AAG[ACG]/' but that transforms individual search for lowercase a or g to upper case A or G. I want to only transform when it found matches to the whole sequence.
Greatly appreciate the help
With sed:
sed 's/\([ag][ag]aag[acg]\)/\U\1/' input
which finds a match to [ag][ag]aag[acg]
and captures this match \\(...\\)
. It then replaces the match with its upper-cased version \\U\\1
.
The sed statement @perreal posted works. are you sure you are using it correctly?
Contents of testsed = agaaga
sed 's/([ag][ag]aag[acg])/\\U\\1/' testsed
AGAAGA
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.