bash - Extract number from first line of a file in linux -


i have file has contents below

spec.2.attrid=revision& spec.2.value=5& spec.3.attrid=num& spec.3.value=vs& 

i using below command extract numbers first line. way efficient or guys think of alternate way ?

cat ticketspecdata | tr -d " " | tr -s "[:alpha:]" "~" | tr -d "[=.=]" | cut -d "~" -f2 

using :

$ grep -om1 '[0-9]\+' file 2 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -