I've this strings in a file that looks like aaaaa;bbbbbbb;ccccc\\n
and aaaaa;bbbbbb\\n
the idea is only to show the text between the last semicolon and newline. Output will be
ccccc
bbbbb
etc.
Thought that I could do it with sed -e [:]$ | awk -F '\\n' {print $1}
sed -e [:]$ | awk -F '\\n' {print $1}
There are many ways to solve the task:
sed 's/.*;//'
awk -F';' '{print $NF}'
rev | cut -d';' -f 1 | rev
只需删除所有内容,直到最后一个分号即可:
sed 's/.*;//'
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.