BTTB: looping for shell script under embedded linux

November 17th, 2010 mysurface

You may already realized Linux happened to appear at many places, such as web server, storage server, desktop, kiosk machine, mobile devices. Yes, more and more devices running embedded Linux. Yeah, Android is a modified version of Linux kernel too! Scarcity is still an issue, embedded Linux can be very different to Linux that hosted […]

Posted in cut, for, if, seq, Text Manipulation | Hits: 251173 | 19 Comments »

How to list all the prime factor?

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:” […]

Posted in Calculation, cut, factor | Hits: 90391 | 1 Comment »

cut can extract multiple columns

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

Posted in cut, Text Manipulation | Hits: 123183 | 6 Comments »

easily extract a column of data from multiple columns

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

Posted in cut, Misc, pipeline, Text Manipulation, xargs | Hits: 117190 | 5 Comments »