Computers and IT

This page collects all about IT, software and computers

lnk Space, nice App

image

made with ink space

Enjoy !

Click here to read more

Linux-commands: ssh tunneling remote server to localhost

To start a ssh tunnel from some machine ports 80 to your localhost port 2001 use the following syntax:

ssh -N -L 2001:localhost:80  somemachine

Enjoy !

Click here to read more

Linux-Commands: Rapidly invoke editor to type long and complex command

To type a long and complex command from linux command line can be painful.  Helpful might be to invoke an editor for writing the details.  You can easily invoke an editor by using the following command:

ctrl-x e

Enjoy !

Click here to read more

Linux Command: Run the last command as root

To run the last command as root you simply can use this command:

sudo !!

Enjoy !

Click here to read more

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 !

Click here to read more

Leave a Reply

%d bloggers like this: