Skip to main content

Posts

Showing posts from March, 2019

Unig Command in Linux

                                    Unig Command in Linux  uniq command use for removing repeated word or lines remove by repeated no          uniq -c <txt file> display only repeated lines               uniq -d <txt file>              there are no repeated lines so printing nothing  display how much time word are matching in lines                 uniq -dc <txt file> display which lines is not repeating in txt file            uniq -u <txt file>             here are no lines are repeating so printing all lines counting repeating line              uniq -uc <txt file>                                                                                                       Written By Sanjay Kumar                                                                                                                                            https://www.instagram.com/sanjaye

grep Command in Linux O.S

                                             grep Command in Linux O.S command   line utility for searching plain-text set for lines that match a regular expression its name come from the cd command g|re|p find word            grep "<word want to find>" <txt file> find only whole word               grep -w  "<word want to find>" <txt file> find regular and lower match waords            grep -wi  "<word want to find>" <txt file> find word in which line               grep -win  "<word want to find>" <txt file> find what is before matches line               grep -win -B  "<word want to find>" <txt file> see upside and lower side of the word          grep -win -c(2,3)  "<word want to find>" <txt file> see matches folders/files              grep -win  "&l

Tr command in linux

                                  Tr command in Linux tr is a command in Unix and Unix-like operating systems. It is an abbreviation of translate or transliterate, indicating its operation of replacing or removing specific characters in its input data set change one word to other               cat a.txt | tr o X (i changer every o with capital x(X) change Upper to upper or lower to upper case              cat a.txt | tr [:upper:] [:lower:] change Upper to lower or upper to upper case              cat a.txt | tr [:lower:] [:upper:] you can use the following command to change all lower case letters to upper case in a file as shown                 cat a.txt | tr [a-z] [A-Z] you can save the results written to stdout in a file for use the shell’s o/p              cat a.txt | tr [a-z] [A-Z] >ab.txt             cat ab.txt you can use the -d flag to delete characters             cat a.txt | tr -d ''

SED commad In Linux O.S

                                         SED command In Linux O.S SED command in UNIX is stands for stream editor and it can perform lot 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. Replacing or substituting string                     sed 's/unix/linux/' a.txt Replacing existing with new characters              sed 's/<old word><new word>' <txt file>                         or              cat <txt file> | sed 's/<old word><new word>' Numbering of txt file and stream edit by sed                        cat -n <txt file> | sed 's/<old word><new word>' if you want to replace all the message or word in txt file          sed 's/<old word>/<new word>/g' <txt file> change all first-word according to ne

TAIL COMMAND IN LINUX

                                            TAIL COMMAND IN LINUX The tail command is a command-line utility for outputting the last part of files given to it via standard input. Print Last 10 lines of a txt files.            tail <file name> Print Last 10 lines of multiples txt files.             tail <file1><file2><file3>..... Print last n line of a txt file          tail -n <txt file> Print last n and combine multiple  txt file            tail -q <file1><file 2> <file3> How to watch a file for changes tail -f <txt file > if i change something the final result will be updated print last n characters in each line           tail -c<no of characters > <txt files>                                                                                            Written By Sanjay Kumar                                   

HEAD command in linux

                                                  HEAD COMMAND IN LINUX O.S head is a program on Unix and Unix-like operating systems used to display the beginning of a text file or piped data head [options] [file(s)] Head Command show First 10 lines                 head <file name> If you want to show first n lines               head -n<no. of .lines> <file name> multiple file and show final 10 linux including all files             head <file1><file2><file3......> Show n lines of the in Multiple files             head -<no of lines> <file 1> <file2>.... print No of characters in Each lines             head -c<no of charector> <file name>                                                                                                                                                                                Written By Sanjay Kumar            

Cut Command in Unix ( Linux)

                                                          CUT cut command select select section of text from each line of line .  You can use the cut command to select fields or columns from a line  examples.. select particular word in each lines          cut -c<which word 1,2,3> <file name>           (cut -c3 a.txt)             2.select multiple word in each lines   cut -c2,3 a.txt   2nd and third word in each line   3.You can print a range of characters in a line by specifying the start and end position    cut c2-5 a.txt    4.To print the characters from tenth position to the end, specify    cut -c<position>- <txt file>  cur -c5- a.txt   5.Given a tab delimited file with several columns (tsv format) print the first three fields.    cut -f-3  6. Given a sentence, identify and display its first three words. Assume that the space (' ') is the     only delimiter between wor