Skip to main content

Text processing or Dat extracting in Linux|How to extract data Text processing in Linux 2020|

 Text Processing

For Text processing orr data extraction on text files linux 

has provided below shell commands to handle

1.cut 

2.awk

3.sed

4.paste

cut -d "," -f 1 file.txt

cut -d "," -f 1 file.txt|sort

d= delimeter

f= number index

for multiple files 2,3 or 2-3


Comments

Popular posts from this blog

Linux Compress and zip Commands|How to unzip and compress in Linux|

  Linux Compress and zip Commands|How to unzip and compress in Linux| packaging  --------------------------------------------------------------------------- group of files in a folder can be packaged into a single file using packaging. Linux has provided a software utility "tar"  packaging= tar -cvf target.tar sourcedirectory un-pack = tar -xvf target.tar un-pack to a different directory = tar -xvf target.tar -C directory to know the size of a file/directory contents we can use below command du -h filename/directoryName compression ------------------------------------------------------------------ The group of files of a folder cannot be compressed directly unless those are packaged into a single tar file.  The compression technic will reduce the size of the original files gzip -------------------------------------------------------------- Linux has provided a software utility "gzip and gunzip" gzip = compression gunzip = uncompression gzip target.tar = it creates t...

Best commands In Linux|Pipe| and Redirection commands|How to use pipe & redirection command|

  Best commands In Linux|Pipe| and Redirection commands|How to use pipe & redirection command| we can use |for joining and executing multiple commands together. we can use pipe (|) is used for joining two linux shell commands and execute together command2 | command3 in the above statement the command2 gets executed first and the output produced by command2 will be passed as an input to the command3. cat pack.txt | wc -l ls -l | wc -l who | wc -l ps -ef | grep firefox how many no of process are running by user ps -ef | grep -w "sai" | wc -l redirections:- ------------------------------------------------------------ redirections are used for redirecting standard input or output of the command. There are 2 types of redirections are there. 1. = input redirection 2. = output redirection Usually a command writes the output onto the standard console if you want to write the output of a command to a different destination like a file then use output redirection copy conten...

Linux cmp and diff commands|Linux commands for devops |difference between cmp and diff

Linux cmp and diff commands|Linux commands for devops |difference between cmp and diff CMP = command is used for comparing the byte by byte of text information of a file and outputs the first difference of the file. cat list1.txt green blue yellow white cat list2.txt green blue black white cmp list1.txt list2.txt output:- list1.txt list2.txt differ: byte 6, line 2 ------------------------------------------------------------------------------------------------------------------------------------- diff = it is used for comparting two text files and displays all the mis-matches in the files. In addition it displays special symbols helping us in understanding what we should do to make those two files identical. a = add c = change the text of the file d = delete line In addition to this it displays the mis-match lines with notation. = indicates the right side file = indicates suggestion should be applied to left side file 2,5c3 =in the left file from 2 - 5 lines should be replaced ...