Sungguk Lim
Sungguk Lim

Reputation: 6228

how can I get a end of word from this line

I tried this.

'svn info | grep revision'

so I can get

Revision: 36991

but the word I want is only

36991

how can I do this? maybe with 'grep'

or shell script

Upvotes: 0

Views: 96

Answers (3)

phatfingers
phatfingers

Reputation: 10250

You can use sed, the stream editor (or awk or cut).

svn info | grep revision | sed "s/[^0-9]\+//"

svn info | sed -e '/revision/!d' -e 's/[^0-9]\+//'

svn info | awk '/revision/ { print $2 }'

svn info | grep revision | cut -d ' ' -f 2

Upvotes: 1

potong
potong

Reputation: 58430

This might work for you:

svn info | sed -n 's/^Revision: //p'

Upvotes: 0

jaypal singh
jaypal singh

Reputation: 77105

Will this work for you -

svn info | awk '/Revision/{ print $2 }' 

Upvotes: 4

Related Questions