Linux commands for file compression and File text manipulation

Commands for file compression:

In this File Compression commands we will explain about the compress and uncompress of a file while compress of a file it takes less space on the disk it contain with dot extension file names is .gz

gzip - it will compress the files and takes less space in the disk and .gz is the file extention

gzip filename.a it will compress the filename.a

guzip - it will uncompressed the files which is compressed by gzip

guzip filename.a it will uncompress the filename.a

Commands for File text manipulation:

In this File Text Manipulation Commands we can cut the columns and fields, we can paste the files and we can merge the two files into one single file. We can sort the order of a file with non-redundancy and also search for matching lines with one or more characters.

cut- it is used to extract specific columns from the file

cut-c it cuts the columns

cut –f it cuts the fields

paste – it is used to paste the files

paste file.a file.b it will join the two files into single file

sort – it used for ordering of a file

sort – file.a it displays only numbers in curous result

sort –n file.a it displays only numbers in ascending order

unique - it fetches one copy of each record or it provides only unique files

unique –u it select only the non-repeated lines

tr - it will translating character

tr –cd it complements the set of characters in the expression

tr –c it compressing the multiple consecutive character

tr –d it will delete character in a file

grep – it will search text for matching lines

grep “nfs” /etc/services it will check any no. of lines that contain the string “nfs” in the file /etc/services and display only those lines

grep string filename.a it will search the string in a filename.a

grep –c it display count of no.of occurrences

grep –l it display list of filenames only

grep –n it displays line number along with lines

grep –h it omits filenames when it contain multiple lines

egrep – it the extending of grep

egrep ch+ it match with one or more character

egrep ch? it matches with zero or one character

egrep exp1| exp 2 it match with expression exp1 or exp2

fgrep – it is multiple string searching

0 comments:

Post a Comment