Skip to main content

Featured post

Ubuntu VI editor Commands to learn today

I have given VI editor commands to use in Ubuntu operating system. You can practice using them for your benefit and you can complete your work quickly.

To begin changing or adding to text with vi, you can enter Insert or Replace modes, as shown in the following list. When you enter Insert or Replace mode, the characters you type will appear in the text document (as opposed to being interpreted as commands).
Ubuntu Vi editor commands Press the Esc key to exit to Normal mode after you are done inserting or replacing text.
List of VI Editor Commands.. i—Typed text appears before current character.

a—Typed text appears after current character.

o—Open a new line below current line to begin typing.

s—Erase current character and replace with new text.

c?—Replace ? with l, w, $, or c to change the current letter, word, end of line, or line.

r—Replace current character with the next one you type.

Shift+i—Typed text appears at the beginning of current line.

Shift+a—Typed text appears at the end…

Top 20 ETL real time interview questions to prepare now

top 20 etl questions asked in many interviews on Unix
#top 20 etl questions asked in many interviews on Unix
1). How to print/display the first line of a file? 
there are many ways to do this. However the easiest way to display the first line of a file is using the [head] command. 
$> head -1 file. Txt
no prize in guessing that if you specify [head -2] then it would print first 2 records of the file. 
another way can be by using [sed] command. [sed] is a very powerful text editor which can be used for various text manipulation purposes like this. 
$> sed '2,$ d' file. Txt
2). how does the above command work? 
The 'd' parameter basically tells [sed] to delete all the records from display from line 2 to last line of the file (last line is represented by $ symbol). Of course it does not actually delete those lines from the file, it just does not display those lines in standard output screen. So you only see the remaining line which is the 1st line. 
3). how to print/display the last line of a file? 
the easiest way is to use the [tail] command. 
$> tail -1 file. Txt
if you want to do it using [sed] command, here is what you should write: 
$> sed -n '$ p' test
from our previous answer, we already know that '$' stands for the last line of the file. So '$ p' basically prints (p for print) the last line in standard output screen. '-n' switch takes [sed] to silent mode so that [sed] does not print anything else in the output. 
4). how to display n-th line of a file? 
the easiest way to do it will be by using [sed] i guess. Based on what we already know about [sed] from our previous examples, we can quickly deduce this command: 
$> sed –n ' p' file. Txt
you need to replace with the actual line number. So if you want to print the 4th line, the command will be 
$> sed –n '4 p' test
of course you can do it by using [head] and [tail] command as well like below: 
$> head - file. Txt | tail -1
you need to replace with the actual line number. So if you want to print the 4th line, the command will be 
$> head -4 file. Txt | tail -1
5). how to remove the first line / header from a file? 
we already know how [sed] can be used to delete a certain line from the output – by using the'd' switch. So if we want to delete the first line the command should be: 
$> sed '1 d' file. Txt
but the issue with the above command is, it just prints out all the lines except the first line of the file on the standard output. It does not really change the file in-place. So if you want to delete the first line from the file itself, you have two options. 
either you can redirect the output of the file to some other file and then rename it back to original file like below: 
$> sed '1 d' file. Txt > new_file. Txt
$> mv new_file. Txt file. Txt
or, you can use an inbuilt [sed] switch '–i' which changes the file in-place. See below: 
$> sed –i '1 d' file. Txt
6). how to remove the last line/ trailer from a file in unix script? 
always remember that [sed] switch '$' refers to the last line. So using this knowledge we can deduce the below command: 
$> sed –i '$ d' file. Txt
7). how to remove certain lines from a file in unix? 
if you want to remove line to line from a given file, you can accomplish the task in the similar method shown above. Here is an example: 
$> sed –i '5,7 d' file. Txt
the above command will delete line 5 to line 7 from the file file. Txt 
8). how to remove the last n-th line from a file? 
this is bit tricky. Suppose your file contains 100 lines and you want to remove the last 5 lines. Now if you know how many lines are there in the file, then you can simply use the above shown method and can remove all the lines from 96 to 100 like below: 
$> sed –i '96,100 d' file. Txt   # alternative to command [head -95 file. Txt] 
but not always you will know the number of lines present in the file (the file may be generated dynamically, etc. ) in that case there are many different ways to solve the problem. There are some ways which are quite complex and fancy. But let's first do it in a way that we can understand easily and remember easily. Here is how it goes: 
$> tt=`wc -l file. Txt | cut -f1 -d' '`;sed –i "`expr $tt - 4`,$tt d" test
as you can see there are two commands. The first one (before the semi-colon) calculates the total number of lines present in the file and stores it in a variable called “tt”. The second command (after the semi-colon), uses the variable and works in the exact way as shows in the previous example. 
9). how to check the length of any line in a file? 
we already know how to print one line from a file which is this: 
$> sed –n ' p' file. Txt
where is to be replaced by the actual line number that you want to print. Now once you know it, it is easy to print out the length of this line by using [wc] command with '-c' switch. 
$> sed –n '35 p' file. Txt | wc –c
the above command will print the length of 35th line in the file. Txt. 
10). how to get the nth word of a line in unix? 
assuming the words in the line are separated by space, we can use the [cut] command. [cut] is a very powerful and useful command and it's real easy. All you have to do to get the n-th word from the line is issue the following command: 
cut –f -d' '
'-d' switch tells [cut] about what is the delimiter (or separator) in the file, which is space ' ' in this case. If the separator was comma, we could have written -d',' then. So, suppose i want find the 4th word from the below string: “a quick brown fox jumped over the lazy cat”, we will do something like this: 
$> echo “a quick brown fox jumped over the lazy cat” | cut –f4 –d' '
and it will print “fox” 
11). how to reverse a string in unix? 
pretty easy. Use the [rev] command. 
$> echo "unix" | rev
xinu
12). how to get the last word from a line in unix file? 
we will make use of two commands that we learnt above to solve this. The commands are [rev] and [cut]. Here we go. 
let's imagine the line is: “c for cat”. We need “cat”. First we reverse the line. We get “tac rof c”. Then we cut the first word, we get 'tac'. And then we reverse it again. 
$>echo "c for cat" | rev | cut -f1 -d' ' | rev
cat
13). how to get the n-th field from a unix command output? 
we know we can do it by [cut]. Like below command extracts the first field from the output of [wc –c] command 
$>wc -c file. Txt | cut -d' ' -f1
109
but i want to introduce one more command to do this here. That is by using [awk] command. [awk] is a very powerful command for text pattern scanning and processing. Here we will see how may we use of [awk] to extract the first field (or first column) from the output of another command. Like above suppose i want to print the first column of the [wc –c] output. Here is how it goes like this: 
$>wc -c file. Txt | awk ' ''{print $1}'
109 
the basic syntax of [awk] is like this: 
awk 'pattern space''{action space}'
the pattern space can be left blank or omitted, like below: 
$>wc -c file. Txt | awk '{print $1}'
109
in the action space, we have asked [awk] to take the action of printing the first column ($1). More on [awk] later. 
14). how to replace the n-th line in a file with a new line in unix? 
this can be done in two steps. The first step is to remove the n-th line. And the second step is to insert a new line in n-th line position. Here we go. 
step 1: remove the n-th line 
$>sed -i'' '10 d' file. Txt       # d stands for delete
step 2: insert a new line at n-th line position 
$>sed -i'' '10 i this is the new line' file. Txt     # i stands for insert
15). how to show the non-printable characters in a file? 
open the file in vi editor. Go to vi command mode by pressing [escape] and then [:]. Then type [set list]. This will show you all the non-printable characters, e. G. Ctrl-m characters (^m) etc. , in the file. 
16). how to zip a file in linux? 
use inbuilt [zip] command in linux 
17). how to unzip a file in linux? 
use inbuilt [unzip] command in linux. 
$> unzip –j file. Zip
18). how to test if a zip file is corrupted in linux? 
use “-t” switch with the inbuilt [unzip] command 
$> unzip –t file. Zip
19). how to check if a file is zipped in unix? 
in order to know the file type of a particular file use the [file] command like below: 
$> file file. Txt
file. Txt: ascii text
if you want to know the technical mime type of the file, use “-i” switch. 
$>file -i file. Txt
file. Txt: text/plain; charset=us-ascii
if the file is zipped, following will be the result 
$> file –i file. Zip
file. Zip: application/x-zip

Comments

Popular posts from this blog

Blue Prism complete tutorials download now

Blue prism is an automation tool useful to execute repetitive tasks without human effort. To learn this tool you need the right material. Provided below quick reference materials to understand detailed elements, architecture and creating new bots. Useful if you are a new learner and trying to enter into automation career.
The number one and most popular tool in automation is a Blue prism. In this post, I have given references for popular materials and resources so that you can use for your interviews.
RPA Blue Prism RPA blue prism tutorial popular resources I have given in this post. You can download quickly. Learning Blue Prism is a really good option if you are a learner of Robotic process automation.

RPA Advantages The RPA is also called "Robotic Process Automation"- Real advantages are you can automate any business process and you can complete the customer requests in less time.

The Books Available on Blue Prism 
Blue Prism resourcesDavid chappal PDF bookBlue Prism Blogs

Data science Secrets Simple Project Useful for Practice

I want to share with you how to use Python for your Data science or analytics Projects. Many programmers struggle to learn Data science because they do not know where to start. You can get hands on if you start with a mini project.

I have used Ubuntu Operating System for this project Skills You Must Need to become a Data Scientist You need dual skills - Learning and Apply knowledge. In Data science you need to learn and apply your knowledge. After study engineering, any person getsB Tech or M Tech Degree. You can become a real engineer if you apply engineering principles. So Data science also the same.

Data Visualization in Python is my simple project Importance of Data Data is the precious resource in resolving Machine Learning and Data Science Problems. Define first what is your problem. Collect Data Wrangle  the Data and Clean it.Visualize the PatternsIn olden days you might be studied a subject called Statistical Analysis. In this subject, you need to study the actual problem an…

Top Solidity Interview Questions for Sure Success

Solidity is the prime language to write logic for smart contracts in Ethereum blockchain. These are selected interview questions refresh before you take any interview.

Interview Questions on Solidity1. What is Solidity?

A) Solidity is the main language that you can use to write programs in Blockchain, such as smart contracts.

2. Where the Solidity programs run in Ethereum?

A). Those will run in EVM. You can also call it as Ethereum virtual Machine.

3. What kind of logic a Smart Contract can contain?

A contract in the sense of Solidity is a collection of code (its functions) and data (itsstate) that resides at a specific address on the Ethereum blockchain

4). Can the source code of smart contract accessible to the outside world? 

A). No, it is not possible to access source code to the network. Also, there is a limited access to one smart contract logic to the other smart contract logic. Eve, file system and other processes cannot access the source code.

Actually the code is sand boxed an…

Hyperledger Fabric Real Interview Questions Read Today

I am practicing Hyperledger. This is one of the top listed blockchains. This architecture follows R3 Corda specifications. Sharing the interview questions with you that I have prepared for my interview.

Though Ethereum leads in the real-time applications. The latest Hyperledger version is now ready for production applications. It has now become stable for production applications.
The Hyperledger now backed by IBM. But, it is still an open source. These interview questions help you to read quickly. The below set of interview questions help you like a tutorial on Hyperledger fabric. Hyperledger Fabric Interview Questions1). What are Nodes?
In Hyperledger the communication entities are called Nodes.

2). What are the three different types of Nodes?
- Client Node
- Peer Node
- Order Node
The Client node initiates transactions. The peer node commits the transaction. The order node guarantees the delivery.

3). What is Channel?
A channel in Hyperledger is the subnet of the main blockchain. You c…

Automation developer these are top Skills you need to learn

Robotic process automation is an upcoming IT skill. Three tools are popular. It is difficult to learn all three tool. So, learn anyone tool to start your career in automation.
To get a job in this line, I found in my research that some programming skills and Hand-on training on any one of the tools is required. Also, try to know the differences between popular RPA tools.
Skills Companies Looking in Automation Engineers All big companies looking for candidates having experience in Automation anywhere, Blue Prism and UIPath. It is not possible to learn all tools. Learn anyone tool and do practice well.

Ok.

You may ask a question about how to do it. Join in good training institute and learn one tool.  Take online classes to learn faster.

To learn Uipath try here. Also, you can enroll online course to learn UiPath.

UiPath GO The list of IT skills you needAutomation anywhere/Blue Prism/Uipath .Net/C#/Java/SQL skills MS-Visio Power Builder Python scripts/Unix Scripts/Perl Scripts HTML/CSS/J…

8 Popular Encryption methods real Usage

Encryption works as it replaces original data with some special characters and stores the data. You need a private key to decrypt the data. Else it is not possible to understand encrypted data even for hackers.

Private keys are two types. Sender uses one private key and receiver uses one other private key.
I have given in this post about 8 encryption methods.

Flow Diagram Encryption
 Different Encryption Methods Classic CipherRandom Key GenerationRSA TokenHash FunctionsMac value - Message Authentication codeKey HashTLS ProtocolAuthenticated Cipher  1. Classic Cipher The best example is this kind of algorithm was used in world war -II communication machines. 2. Random Key Generations One kind of security. They use an algorithm that sends random numbers. People use that number as a password.
3. RSA Token Every 60 seconds a token is generated. Mostly people use for financial applications. An extra identity mechanism along with user id and password. 4. Hash Functions It assigns a hash va…

Ubuntu VI editor Commands to learn today

I have given VI editor commands to use in Ubuntu operating system. You can practice using them for your benefit and you can complete your work quickly.

To begin changing or adding to text with vi, you can enter Insert or Replace modes, as shown in the following list. When you enter Insert or Replace mode, the characters you type will appear in the text document (as opposed to being interpreted as commands).
Ubuntu Vi editor commands Press the Esc key to exit to Normal mode after you are done inserting or replacing text.
List of VI Editor Commands.. i—Typed text appears before current character.

a—Typed text appears after current character.

o—Open a new line below current line to begin typing.

s—Erase current character and replace with new text.

c?—Replace ? with l, w, $, or c to change the current letter, word, end of line, or line.

r—Replace current character with the next one you type.

Shift+i—Typed text appears at the beginning of current line.

Shift+a—Typed text appears at the end…

Three popular RPA tools functional differences

Robotic process automation is growing area and many IT developers across the board started up-skill in this popular area. I have written this post for the benefit of Software developers who are interested in RPA also called Robotic Process Automation.


In my previous post, I have described that total 12 tools are available in the market. Out of those 3 tools are most popular. Those are Automation anywhere, BluePrism and Uipath. Many programmers asked what are the differences between these tools. I have given differences of all these three RPA tools.

BluePrism Blue Prism has taken a simple concept, replicating user activity on the desktop, and made it enterprise strength. The technology is scalable, secure, resilient, and flexible and is supported by a comprehensive methodology, operational framework and provided as packaged software.The technology is developed and deployed within a “corridor of IT governance” and has sophisticated error handling and process modelling capabilities to ens…