Showing posts with label Unix filter command. Show all posts
Showing posts with label Unix filter command. Show all posts

Sunday, 10 June 2018

Filters and commands: sed command in Unix systems with examples

SED command in UNIX is stands for stream editor and it can perform lot’s of function on file like, searching, find and replace, insertion or deletion. Though most common use of SED command in UNIX is for substitution or for find and replace. By using SED you can edit files even without opening it, which is much quicker way to find and replace something in file, than first opening that file in VI Editor and then changing it.

Filters and commands: join command in Unix systems with examples

join command is the tool for it. join command is used to join the two files based on a key field present in both the files. The input file can be separated by white space or any delimiter.

Saturday, 9 June 2018

Filters and commands: tr command in Unix systems with examples

The tr command in UNIX is a command line utility for translating or deleting characters. It supports a range of transformations including uppercase to lowercase, squeezing repeating characters, deleting specific characters and basic find and replace.

Filters and commands: uniq command in Unix systems with examples

The uniq command in Linux is a command line utility that reports or filters out the repeated lines in a file.


Filters and commands: paste command in Unix systems with examples

It is used to join files horizontally (parallel merging) by outputting lines consisting of lines from each file specified, separated by tab as delimiter, to the standard output.







Filters and commands: sort command in Unix systems with examples

SORT command is used to sort a file, arranging the records in a particular order. By default, the sort command sorts file assuming the contents are ASCII. Using options in sort command, it can also be used to sort numerically. 





Filters and commands: cut command in Unix systems with examples

The cut command in UNIX is a command for cutting out the sections from each line of files and writing the result to standard output. It can be used to cut parts of a line by byte position, character and field. Basically the cut command slices a line and extracts the text. It is necessary to specify option with command otherwise it gives error. 
 

Filters and commands: Tail command in Unix systems with examples

The tail command, as the name refers that it display the last N lines of given input content. By default, the value of N is 10 lines. While no option is mentioned in command then it display last 10 lines of the file content.

~$ man tail   (on Linux ubuntu 16.10)
 





~$cat testfile4      // display content of testfile4
~$ tail -5 testfile4   // displays last five lines of the content of the file
~$ awk 'END { print NR }' testfile4   // no of lines in testfile4
~$ tail -n +14 testfile4   // displays last 7 lines starting from the line No. 14
~$ tail -c -5 testfile4   // displays last five bytes of the file
~$ tail -c +100 testfile4   // displays last 23 bytes starting from the byte No. 100




~$tail -f testfile3      // display live content of testfile3 (logfile)

In case, if user want to see log content of log-file of some currently running process. For example, Android studio log file is generated and can be seen while App is debugging.

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts