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:
This is a preview of
How to select odd (or even ) raws from a text file using the bash
.
Read the full post (292 words, estimated 1:10 mins reading time)
Categories: Bash Tip & Tricks, linux, Mac OS X, sysadmin, Tower of Babel, UNIX TLC, xAppSoftware News Tags: awk, bash, bash script, sed, tip, tips, tricks
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).
This is a preview of
3 ways to remove duplicate lines from a text file
.
Read the full post (222 words, 1 image, estimated 53 secs reading time)
Categories: Bash Tip & Tricks, linux, Mac OS X, sysadmin, UNIX TLC, xAppSoftware News Tags: awk, bash, shell, sort, tips, tricks, uniq
Twidge is a full command-line client. It is designed to be useful when you’re sitting at a shell prompt. It’s also designed to work well with the Unix/POSIX/Linux shell scripting environment. It produces output in well-formed and easily-parsed ways, and has various features for working with piped data.
This is a preview of
Twidge: A flexible way to gain the access to Twitter resources
.
Read the full post (408 words, estimated 1:38 mins reading time)
From the wikipedia
"A RAM disk or RAM drive is a block of RAM that a computer's software is treating as if the memory were a disk drive.
….
….
….
This is a preview of
How to create a ramdisk on Mac OS X Snow Leopard
.
Read the full post (417 words, estimated 1:40 mins reading time)
GNU Midnight Commander is a user-friendly yet powerful file manager and visual shell, useful to novice and guru alike. It provides a clear, user-friendly, and somewhat protected interface to a Unix system while making many frequent file operations more efficient and preserving the full power of the command prompt.
If you want to customize a distribution to boot only on your particular computer you should be able to modify the initrd and rootfs files.
This is a preview of
A simple tool to modify initrd and rootfs
.
Read the full post (437 words, estimated 1:45 mins reading time)
On Mac OS X you could give colors to the output of the "ls" command simply adding an alias:
# alias ls ='ls -G'
also you can show a / at the end of a directory name using the -p switch
# alias ls='ls -p'
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:
This is a preview of
How to remove all files generated by an extracted tar archive
.
Read the full post (97 words, estimated 23 secs reading time)
Often we look for new way to boost up our work, so we write a lot of code to perform jobs at high speed.
Sometimes the right way is the old way, specially if we need to do repetitive jobs. To do this kind of jobs we can use the xargs command, this command used in pipe with other commands can automate our jobs.
For example if we want to remove all C files from a directory and from all subdirectory recursively we can do the following:
This is a preview of
Using xargs to parallelize and speed up jobs.
.
Read the full post (616 words, estimated 2:28 mins reading time)
Sometimes during my work I need to remove a set of files from a big directory tree. For example when I develop a driver or an application and I want to distribute to my customers only the obj files and the documentation files (README.txt, INSTALL.txt, LICENSE.txt, Makefile ……) I need to remove all my source code (*.c and *.h), this is a very tedious task, but I can use the bash to do this task for me, and I’m quite sure that bash doesn’t forget any files.
Latest Comments