Manipulating Data on Linux

1.Login to your linux server via SSH or putty

2.Getting your data to and from the Linux host   via 

 scp, WinSCP   

sshfs

 ftp  

wget, curl

3.Simple data files - examination and slicing

file anonymous                to know what kind of file it is

ls -lh red+blue_all.txt

wc -l red+blue_all.txt       to know how big the file is

4.Viewing and Manipulating the data

 more & less

head & tail      head -2 file1

cat                   show all from the first Bite

tac                   show all from the last line

paste

“The grep family”

Manipulating Data on Linux_第1张图片

Manipulating Data on Linux_第2张图片

Manipulating Data on Linux_第3张图片

Manipulating Data on Linux_第4张图片

Manipulating Data on Linux_第5张图片

Manipulating Data on Linux_第6张图片

sort

sort names.txt                                      Sort a file in ascending order

sort -r names.txt                                   Sort a file in descending order

sort -t: -k 3n /etc/passwd I more          Sort passwd file by 3rd field 

 

awk

awk -F ':' 'S3==S4' passwd.txt             Print all lines from /etc/passwd that has the same uid and gid

awk '{print $2,$5;}' employee.txt          Print only specific field from a file

你可能感兴趣的:(Linux)