captain yossarian
captain yossarian

Reputation: 457

sed/awk - removing text between delimiters

How would I remove all text between certain delimiters.

example:

hello;you;are;nice

returns:

hello;you;nice

in sed, i know how to remove text before the first delimiter and after the last, but not sure otherwise...

thanks as always to everyone.

Upvotes: 1

Views: 1113

Answers (3)

Kent
Kent

Reputation: 195079

awk -F\; -v OFS=";" '{print $1,$2,$4}' file

Upvotes: 1

Yann Moisan
Yann Moisan

Reputation: 8281

It is quite straigthforward with sed

sed "s/\w*;//3"

Upvotes: 2

Tom Ron
Tom Ron

Reputation: 6181

What about using cut -

cut -d; -f2-3

Upvotes: 2

Related Questions