DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Cut Some Text From File

  • submit to reddit
        // 1234567@2345|[HELLO]|adcbdefhij: asgdfdasdfhhfd-asdfasd-dsfasdf |0.678|0.0|0.213
// 1234567@2345|[HELLO]|adcbdefhij: ashhfd-asdfasd-dsfasdf |0.129|0.0|0.411
// 1234567@2345|[HELLO]|adcbdefhij: asd-aasd-dasdf |0.223|0.0|0.276
// delete the text which occurs between @ and :
// remove the numbers which occur at the end of every line |0.223|0.0|0.276
awk 'BEGIN{FS="[@:|]"}{ printf "%s%s\n",$1,$5}' file