easily extract a column of data from multiple columns
0 votos
October 2nd, 2006 mysurface Posted in Misc, Text Manipulation, cut, pipeline, xargs | Hits: 14580 |
To extract a column of data from multiple column, we can use cut. Usually cut use to extract value from huge trace file or data file such as /etc/passwd.
To extract all available user name from /etc/passwd, you can do this
cut -d":" -f1 /etc/passwd
Cut extract value line by line, to put all into 1 line, you can use xargs
cut -d":" -f1 /etc/passwd | xargs echo
Live Chat!









October 2nd, 2006 at 7:26 pm
Thanks! It’s very useful to extract data.
August 1st, 2007 at 2:01 am
[...] Check out command cut for usage examples. [...]