Archive

Posts Tagged ‘tricks’

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:

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.

How to remove all files generated by an extracted tar archive

December 24th, 2009 No comments

Often I use tar files downloaded from the internet, sometimes these files don't include a directory containing all other files and directories, so it's very tedious removing all files generated by the extraction, but I can use the following command to remove all the files generated:

Categories: Bash Tip & Tricks, linux Tags: , , ,
Statistical data collected by Statpress SEOlution (blogcraft).