[shell scipts] 1 số bài tập AWK đơn giản [shell scipts] 1 số bài tập AWK đơn giản

bai 1: su dung awk in tat ca file /etc/passwd awk '{print}' /etc/passwd hoac co the viet awk '{print $0}' /etc/passwd b...

Read more »

[shell scripts] Scripts kiểm tra %CPU và %MEM [shell scripts] Scripts kiểm tra %CPU và %MEM

#!/bin/bash # %CPU a=$(ps -eo pcpu | awk '{tongcpu+=$1} END {print tongcpu}') echo "tong % CPU la: $a" # %MEM b=$(ps ...

Read more »

[shell scripts] Tìm mã trên dãy số [shell scripts] Tìm mã trên dãy số

#!/bin/bash echo -n "nhap n: " read n for ((i=0; i<n; i++)) do  read -p "a[$i]= " a[$i] done max=${a[0]} for ...

Read more »

[shell scripts] Tinh tổng S=1+2+3+...+n [shell scripts] Tinh tổng S=1+2+3+...+n

#!/bin/bash echo "nhap n tu ban phim: " read n s=0 for ((i=1; i<=$n; i++)) do let s=s+1 done echo "tong s= $s...

Read more »

[shell scripts]  tim kiem file [shell scripts] tim kiem file

#!/bin/bash echo -n "nhap file can tim kiem: " read file name_file=$(find / -name $file) echo "ket qua: $name_file" if ...

Read more »

[ shellscripts ] Giai phương trình bậc 2 [ shellscripts ] Giai phương trình bậc 2

#!/bin/bash echo "nhap 3 so a,b,c: " read a read b  read c delta=$(echo "$b*$b-4*$a*$c" | bc) if [ $delta -lt 0 ];...

Read more »

Shellscripts batch file rename Shellscripts batch file rename

Scripts rename hang loat: #!/bin/sh // đổi hang loạt file.rb.txt thanh file .rb for f in *.rb.txt; do  mv "$f" "${f%.txt...

Read more »

Xu li danh sach sinh vien trong shellscipts Xu li danh sach sinh vien trong shellscipts

#!/bin/bash while [ TRUE ] do echo        "MENU" echo '[1] Tao danh sach' echo "2) In danh sach" echo ...

Read more »

 File quan li sinh vien trong shellscipts File quan li sinh vien trong shellscipts

bai tap: Tạo một file text tên các sinh viên, năm sinh, quê quán, chuyên ngành.  #!/bin/bash echo "tao 1 file sv.txt" read -p ...

Read more »

 lenh tail va head trong shell scripts lenh tail va head trong shell scripts

- head < tên file>: hiển thị các dòng đầu tiên. - tail < tên file>: hiển thị các dòng cuối cùng (có thể hữu ích trong những trư...

Read more »

1 so bai tap awk don gian 1 so bai tap awk don gian

bai 1: su dung awk in tat ca file /etc/passwd awk '{print}' /etc/passwd hoac co the viet awk '{print $0}' /etc/passwd bai ...

Read more »

Lệnh AWK - phần 2 Lệnh AWK - phần 2

Các biến định nghĩa sẵn trong AWK Biến FS - Field separator - Ký tự ngăn cách các trường      Mặc định ký tự dùng để ngăn cách các trường là...

Read more »

Lệnh AWK - phần 1 Lệnh AWK - phần 1

Là một ngôn ngữ xử lý file text, rất mạnh đối với các file text mà mỗi dòng là một dạng bản ghi (record format), tức là có các trường, cột ...

Read more »

Sự khác biệt ">" va ">>" trong shell scripts Sự khác biệt ">" va ">>" trong shell scripts

">>" sẽ thêm data vao file ">" xoa nd file cu và chep nội dung mới vào VD #!/bin/bash echo "t...

Read more »

bài 2: Tính giai thừa trong shellscripts bài 2: Tính giai thừa trong shellscripts

#!/bin/bash echo "tinh giai thua: " read n gt=1 while [ $n -gt 0 ] do let gt=gt\*n let n=n-1 done echo...

Read more »

1, Tìm max trong 3 số trong shellscripts 1, Tìm max trong 3 số trong shellscripts

#!/bin/bash echo "nhap 3 so tu ban phim: " read a read b read c max=$a if [ $max -le $b ]; then let max=b ...

Read more »
 
Top

Nhận xét mới đăng tải!

Loading…
X