Grep Command GREP -- stands for Global Regular Expression Parser searching for a word in a file grep 200 filename example I am searching for string "ravana" in the file $ grep ravana data.txt Ravana 9309080497 ravana@gmail.com Newzealand Ravana 9309080497 ravana@gmail.com Newzealand You can also use "" to look for the content $ grep "ravana" data.txt Ravana 9309080497 ravana@gmail.com Newzealand Ravana 9309080497 ravana@gmail.com Newzealand Ravana 9309080497 ravana@gmail.com Newzealand Searching data in more than one file. grep "john" filename1 filename2 $ grep "ravana" data.txt info.txt data.txt:R...
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Certainly! Here's an overview of some basic Linux commands: ls : This command lists the files and directories in the current directory. cd : This command changes the current directory to the specified directory. pwd : This command prints the current working directory. mkdir : This command creates a new directory. rmdir : This command removes an empty directory. rm : This command removes a file or directory. cp : This command copies a file or directory. mv : This command moves or renames a file or directory. cat : This command prints the contents of a file. less : This command displays the contents of a file, one page at a time. grep : This command searches for a pattern in a file. echo : This command prints a message to the screen. chmod : This command changes the permissions of a file or directory. chown : This comma...
-- show line numbers of the lines in a file cat -n <file_name> creating a file cat > testing enter content quite -- testing file is created Create a copy of the file cat StudentData > StudentData Merging two files and creating a new file. cat <file1> <file2> > totaldata.txt append a content of a file to a existing file cat <file_name> >> <file_name> showing a file in reverse order -- cat command now becomes tac tac <file_name> list files ls -ltr list all files in human readable format ls -ltrh display files ignoring blank lines cat -n -b <file_name> -b // skips blank lines head command to show only first 10 lines from a file head <file_name> first 10 line display first 20 lines from a file head -n 20 <file_name> or head -20 <file_name> display 200 bytes of data from this file head -c <file_name> skip last 28 lines head -n -28 l...
Comments
Post a Comment