AWK in Linux

awk Linux Commands

What is Linux awk Command?

Explanation

awk COMMAND:
awk command is used to manipulate the text.This command checks each line of a file, looking for patterns that match those given on the command line.

SYNTAX:
The Syntax is
awk ‘{pattern + action}’ {filenames}

OPTIONS:

-W version Display version information and exit.

-F Print help message and exit.

EXAMPLE:
Lets create a file file1.txt and let it have the following data:

Data in file1.txt
141516
151511
5566
5251

To print the second column data in file1.txt

awk ‘{print $2}’ file1.txt

This command will manipulate and print second column of text file (file1.txt). The output will look like

15155625
To multiply the column-1 and column-2 and redirect the output to file2.txt:

awk ‘{print $1,$2,$1*$2}’ file1.txt > file2.txt

Command Explanation:
$1: Prints 1st column
$2: Prints 2ndcolumn
$1*$2: Prints Result of $1 x $2
file1.txt: input file
symbolfile2.txt: output file

The above command will redirect the output to file2.txt and it will look like,
14 15 21015 15 2255 56 2805 25 125

Enjoy !

Alias-Command in Linux

alias COMMAND:alias command allows you to create a shortcut to a command. As the name indicates, you can set alias/shortcut name for the commands/paths which is too longer to remember.

SYNTAX:The Syntax is 
alias [options] [ AliasName [ =String ] ]

OPTIONS:

-a Removes all alias definitions from the current shell execution environment.
-p Prints the list of aliases in the form alias name=value on standard output.

EXAMPLE:To create a shortcut temporarily:

alias lhost=’cd /var/www/html’

This command will set lhost to cd /var/www/html/.

Now if you type lhost it will take you to the specified folder/directory.

To create a shortcut Permanently:
You can put your aliases into the /home/user/.bashrc file. It is good to add them at the end of the file.

alias home=’cd /var/www/html/hscripts/linux-commands’

Now if you type home it will take you to the specified folder/directory.

To create a shortcut for a command:

alias c=’clear’

This command will set c to clear.
Now if you type c it will clear the screen.

Enjoy !

Dangerous Crypto Trojan is spreading very fast

Bildschirmfoto 2016-02-29 um 22.50.38

The dangerous crypto Trojan Locky infects an average of 5,000 installations per hour in Germany !!

The Trojan encrypts drives after infection, but not only local drives but also encrypts all available network shares and all accessible cloud storage too. Details for the dissemination and the  damages caused, can be found here:

http://www.heise.de/security/meldung/Krypto-Trojaner-Locky-wuetet-in-Deutschland-Ueber-5000-Infektionen-pro-Stunde-3111774.html

qTranslate X seems to work

Now that I have spent the whole day to set up the experiment, a multisite in WordPress and then subsequently work with the multisite language switcher, finally i gave up.
Seems that my Provider One.com, doesn’t support Subdomain Handling in WordPress.
Now I#m trying out the qTranslate X Plugin, which is far easier to install and better manageable. I’ll continue to write on this topic when I am more experienced in handling the plugin.

Enjoy !

WordPress App- first Attempts

Recently downloaded and installed the WordPress- App for Android from Google Play Store. This Post was created using this app. It seems to work at first sight.. Below is a picture that I created on my smartphone and uploaded to my blog using this app:

image