Archive

Posts Tagged ‘tips’

How to select odd (or even ) raws from a text file using the bash

January 27th, 2012 No comments

Yesterday I had to select some raws (1, 5, 9, ….) from a text file.

This has been a hard job because I was trying to solve the wrong problem……

Really, before coding you should analyze deeply your problem and then you should think which tool you need to use.

However, come on and see my experiments:

First of all we need a test file, I'll use the following:

3 ways to remove duplicate lines from a text file

December 27th, 2011 No comments

 

One of the more diffcult job, while using the shell, is working with text files to filter their content.


In the following few lines you will find 3 different ways to remove all the duplicate lines from a text file.


First of all, I'll introduce three commands that are available on almost all of the linux distributions, and maybe in all Unix dialects:

uniq

Discard all but one of successive identical lines from INPUT (or standard input), writing to OUTPUT (or standard output).

 

Ubuntu 9.10: error while loading shared libraries: libtinfo.so.5

October 23rd, 2011 No comments

 

Under Ubuntu 8.10, 9.04 and 9.10 the entrypoints for libinfo are part of ncurses.

The libtinfo.so functionality is built into the libncurses.so shared library. So for software that uses the libtinfo.so object you need to install ncurses. I have had to install ncurses because I was trying to build a busybox system on my Ubuntu box and mconf told:

How to take a screen shot of the iphone display

October 10th, 2011 1 comment

Since iOS 2.x the iPhone operating system comes with the capability to take screen shots from the current running application. This feature sometimes can be very useful, but the gesture to take the screen shots is very simple but it isn't very publicized.

A useless trick for Mac OS X: The Desktop Background

November 26th, 2010 No comments

It is possible to use a screensaver as background image in Mac OS X. Simply follow the following steps:

  • Set your screen saver to something cool
  • Open a new Terminal window
  • Type the following command:

# /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background

that's all, now your desktop will show your screensaver.

Categories: Bash Tip & Tricks, Mac OS X Tags: , ,

Customizing the login window on Mac OS X

November 21st, 2010 No comments

It is possible adding a text string to the login window, for example you can add a welcome message, simply open a new terminal window and type the following command:

# sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "Hi man”

Using the clipboard from the Mac OS X Terminal

August 24th, 2010 No comments

You can use the clipboard from the directly from the terminal application, Mac OS X gives you two commands:

pbcopy

pbpaste

Naturally pbcopy will copy something on the clipboard and pbpaste will paste something from the clipboard.

Screenshots in Mac OS X

August 17th, 2010 No comments

Mac OS X gives you the ability to grab a screenshot of your monitor using the following combination:

Cmd-Shift-3

Also it provides the capability to grab only a portion of your screen using the following combination:

Cmd-Shift-4

The open command on Mac OSX terminal

August 10th, 2010 No comments

On your Mac OS X terminal you can use the open command like a double click.

For example you can issue the following command:

# open .

this command will open the working directory in the finder.

Statistical data collected by Statpress SEOlution (blogcraft).