Linux內建函式練習

2021-09-05 08:53:25 字數 608 閱讀 1874

1、去目錄下複製檔案/root/file/ip.txt到自己目錄下,統計第一列(用空格隔開)ip的出現的頻率。

awk 'nr>1end' ip.txt

2、用awk 計算1+2+3…..+100的累計值

awk 'begin'

3、用awk 

**寫入

shell

指令碼中,實現九九乘法表的列印

awk 'beginprintf "\n"}}'

4、使用rand等函式,每次隨機輸出乙個大於6且小於10的整數。

awk 'begin}}'

5、複製檔案/root/test/teacher.text到自己目錄,該檔案的列分隔符號為「,」,請把第一列的*號去掉

awk -f, '' teacher.txt

6、統計teacher.text資料中有多少個男同學,有多少個女同學

awk -f : '/女/end' teacher.txt && awk -f : '/男/end' teacher.txt

內建函式 練習

print all 1,5,3 print any a ascii 1,2,開外掛程式開外掛程式 print type a a print bin 2555 print bool 0 a bytes abcde encoding utf 8 print a.capitalize a b bytear...

內建高階函式練習

332.31321 0 0 1 1 from functools import reduce def str2int s def char2int ch c print c return c ch def fun n1,n2 return n1 10 n2 return reduce fun,map...

函式 內建函式 匿名函式 相關練習

4,用map來處理字串列表,把列表中所有人都變成sb,比方alex sb name oldboy alex wusir print list map lambda a a sb name 5.用map來處理下述l,然後用list得到乙個新的列表,列表中每個人的名字都是sb結尾 l print lis...