cut

echo 'This is a test' | cut -d ' ' -f2-
is a test
How to cut TAB character
cat ct
Hello the world test with       tab
cat ct | cut -d$'\t' -f3-
tab
-------------------
bash-3.00# cat a.txt
root console Apr 10 15:17 (:0)
root pts/3 Apr 10 15:20 (:0.0)


bash-3.00# cut -f2 a.txt
(:0)
(:0.0)


bash-3.00# cut -f1 -d":" a.txt
root console Apr 10 15
root pts/3 Apr 10 15
-------------
cut -f 1-d ':' /etc/passwd | sort

Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all