2016-04-14 15 views

cevap

4

Sen awk kullanabilirsiniz: Başka küçük awk varyantı RS kullanılarak

str='Al99.NegFRho.ZeroRhoR.ZeroPhiR.eam.alloy' 
awk -F. -v OFS='\n' '{print $2, $3, $4}' <<< "$str" 

NegFRho 
ZeroRhoR 
ZeroPhiR 

: sed ile

awk -v RS=. 'NR>=2 && NR<=4' <<< "$str" 

NegFRho 
ZeroRhoR 
ZeroPhiR 
+1

harika. çok teşekkürler! – kensaii

1

Eğer

$ sed 's/^[^.]*\.\([^.]*\)\.\([^.]*\)\.\([^.]*\)\..*/\1\n\2\n\3/' <<<"$str" 
NegFRho 
ZeroRhoR 
ZeroPhiR 

Veya, GNU grep kullanmayı tercih:

$ grep -oP '\.\K[^.]+' <<<"$str" | head -3 
NegFRho 
ZeroRhoR 
ZeroPhiR 
+1

@anubhava, woops, teşekkürler. –