A.txt
+++ begin A.txt +++
ABC/123/xyz
DEF/456/uvw
+++ end A.txt +++
Would like to get the last column: ( / as the delimiter)
expect output:
xyz
uvw
Method 1:
awk -F"/" '{print $NF} A.txt
Method 2:
rev A.txt|cut -d '/' -f 1|rev
Method 3:
grep -o '[^/]*$' A.txt
Method 4:
perl -pe 's/(.*)\/(.*)$/$2/' A.txt
ref:
https://stackoverflow.com/questions/22727107/how-to-find-the-last-field-using-cut
沒有留言:
張貼留言