Live Chat!

How to list all the prime factor?

          0 votos

November 2nd, 2006 mysurface

Are you thinking of using c/c++ or bash script to do that? Don’t do that, linux have ready made command. Its call factor.
Let say I want to list the prime factor for 232.
factor 232
The result will be
232: 2 2 2 29
What if I want only the factor with the “232:” ? We can use [...]

Posted in Calculation, cut, factor | Hits: 10094 | No Comments »

cut can extract multiple columns

* * *     2 votos

October 11th, 2006 mysurface

I am here to shows an example of cut extract 2 columns from 5 columns.
cut -d” ” -f1,5 <<< “hello, my name is mysurface.”
The result output is
Hello, mysurface.
-d specified the delimiter, -f specified the fields to extract.
Related Postsawk, simple but efficient text manipulation tool.Awk is a simple and efficient for text manipulation, it is [...]

Posted in Text Manipulation, cut | Hits: 9839 | No Comments »

easily extract a column of data from multiple columns

          0 votos

October 2nd, 2006 mysurface

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 [...]

Posted in Misc, Text Manipulation, cut, pipeline, xargs | Hits: 16003 | 2 Comments »