Awkѧϰ�ʼ�
Copyright ? 2004 ��������GPLЭ�飬��ӭת�ء��ġ�ɢ����
��һ�η���ʱ��:2004��8��6��
Table of Contents
awk��һ�ֱ������ԣ�������linux/unix�¶��ı������ݽ��д��������ݿ������Ա����롢һ���������ļ�����������������������֧���û��Զ��庯���Ͷ�̬��������ʽ���Ƚ����ܣ���linux/unix�µ�һ��ǿ�����̹��ߡ�������������ʹ�ã�����������Ϊ�ű���ʹ�á�awk�Ĵ����ı������ݵķ�ʽ�������ģ�������ɨ���ļ����ӵ�һ�е�����һ�У�Ѱ��ƥ�����ض�ģʽ���У�������Щ���Ͻ�������Ҫ�IJ���������û��ָ����������������ƥ��������ʾ��������(��Ļ)������û��ָ��ģʽ�������б�������ָ�����ж���������awk�ֱ��������������ϵĵ�һ����ĸ����Ϊ���������������ˣ��ֱ���Alfred Aho��Brian Kernighan��Peter Weinberger��gawk��awk��GNU�汾�����ṩ��Bellʵ���Һ�GNU��һЩ��չ���������ܵ�awk����GUN��gawkΪ���ģ���linuxϵͳ���Ѱ�awk���ӵ�gawk����������ȫ����awk���н��ܡ�
-
awk [options] 'script' var=value file(s)
-
awk [options] -f scriptfile var=value file(s)
- -F fs or --field-separator fs
-
ָ�������ļ��۷ָ�����fs��һ���ַ���������һ����������ʽ����-F:��
- -v var=value or --asign var=value
-
��ֵһ���û�����������
- -f scripfile or --file scriptfile
-
�ӽű��ļ��ж�ȡawk���
- -mf nnn and -mr nnn
-
��nnnֵ�����������ƣ�-mfѡ�����Ʒ�����nnn����������Ŀ��-mrѡ�����Ƽ�¼��������Ŀ��������������Bellʵ���Ұ�awk����չ���ܣ��ڱ�awk�в����á�
- -W compact or --compat, -W traditional or --traditional
-
�ڼ���ģʽ������awk������gawk����Ϊ�ͱ���awk��ȫһ�������е�awk��չ�������ԡ�
- -W copyleft or --copyleft, -W copyright or --copyright
-
��ӡ���̵İ�Ȩ��Ϣ��
- -W help or --help, -W usage or --usage
-
��ӡȫ��awkѡ����ÿ��ѡ���ļ���˵����
- -W lint or --lint
-
��ӡ��������ͳunixƽ̨��ֲ�Ľṹ�ľ��档
- -W lint-old or --lint-old
-
��ӡ���ڲ�������ͳunixƽ̨��ֲ�Ľṹ�ľ��档
- -W posix
-
����ģʽ�������������ƣ���ʶ����x�������ؼ��֡�func�����������Լ���fs��һ���ո�ʱ����������Ϊһ�����ָ�����������**��**=���ܴ���^��^=��fflush��Ч��
- -W re-interval or --re-inerval
-
����������������ʽ��ʹ�ã��ο�(grep�е�Posix�ַ���)�������ű���ʽ[[:alpha:]]��
- -W source program-text or --source program-text
-
ʹ��program-text��ΪԴ���룬����-f�������á�
- -W version or --version
-
��ӡbug������Ϣ�İ汾��
- awk�ű�����ģʽ�Ͳ������ɵģ�
-
pattern {action} ��$ awk '/root/' test����$ awk '$3 < 100' test��
�����ǿ�ѡ�ģ�����û��ģʽ����actionӦ�õ�ȫ����¼������û��action��������ƥ��ȫ����¼��Ĭ�������£�ÿһ�������ж���һ����¼�����û���ͨ��RS����ָ����ͬ�ķָ������зָ���
ģʽ��������������һ����
-
/��������ʽ/��ʹ��ͨ��������չ����
-
��ϵ����ʽ���������������������еĹ�ϵ���������в������������ַ��������ֵıȽϣ���$2>%1ѡ���ڶ����ֶαȵ�һ���ֶγ����С�
-
ģʽƥ������ʽ����������~(ƥ��)��~!(��ƥ��)��
-
ģʽ��ģʽ��ָ��һ���еķ�Χ��������ܰ���BEGIN��ENDģʽ��
-
BEGIN�����û�ָ���ڵ�һ��������¼������֮ǰ�������Ķ�����ͨ��������������ȫ�ֱ�����
-
END�����û�������һ��������¼����ȡ֮�������Ķ�����
Table 1. awk��������
| ���� | ���� |
|---|---|
| $n | ��ǰ��¼�ĵ�n���ֶΣ��ֶμ���FS�ָ��� |
| $0 | ������������¼�� |
| ARGC | �����в�������Ŀ�� |
| ARGIND | �������е�ǰ�ļ���λ��(��0��ʼ��)�� |
| ARGV | ���������в��������顣 |
| CONVFMT | ����ת����ʽ(Ĭ��ֵΪ%.6g) |
| ENVIRON | ���������������顣 |
| ERRNO | ����һ��ϵͳ������������ |
| FIELDWIDTHS | �ֶο����б�(�ÿո����ָ�)�� |
| FILENAME | ��ǰ�ļ����� |
| FNR | ͬNR���������ڵ�ǰ�ļ��� |
| FS | �ֶηָ���(Ĭ�����κοո�)�� |
| IGNORECASE | ����Ϊ�棬�����к��Դ�Сд��ƥ�䡣 |
| NF | ��ǰ��¼�е��ֶ����� |
| NR | ��ǰ��¼���� |
| OFMT | ���ֵ�������ʽ(Ĭ��ֵ��%.6g)�� |
| OFS | �����ֶηָ���(Ĭ��ֵ��һ���ո�)�� |
| ORS | ������¼�ָ���(Ĭ��ֵ��һ�����з�)�� |
| RLENGTH | ��match������ƥ�����ַ����ij��ȡ� |
| RS | ��¼�ָ���(Ĭ����һ�����з�)�� |
| RSTART | ��match������ƥ�����ַ����ĵ�һ��λ�á� |
| SUBSEP | �����±��ָ���(Ĭ��ֵ�� 34)�� |
awk��ÿһ���Ի��з��������г�Ϊһ����¼��
��¼�ָ�����Ĭ�ϵ������������ķָ������ǻس����������ڽ�����ORS��RS�С�
$0��������ָ����������¼����$ awk '{print $0}' test������test�ļ��е����м�¼��
����NR��һ����������ÿ������һ����¼��NR��ֵ������1����$ awk '{print NR,$0}' test������test�ļ������м�¼�����ڼ�¼ǰ��ʾ��¼�š�
��¼��ÿ�����ʳ�������Ĭ���������Կո���tab�ָ���awk�ɸ������ĸ����������ڽ�����NF�б�����ֵ����$ awk '{print $1,$3}' test����ӡtest�ļ��е�һ�͵������Կո��ֿ�����(��)��
�ڽ�����FS�����������ָ�����ֵ��Ĭ���ǿո���tab�����ǿ���ͨ��-F������ѡ����FS��ֵ����$ awk -F: '{print $1,$5}' test����ӡ��ð��Ϊ�ָ����ĵ�һ�������е����ݡ�
����ͬʱʹ�ö������ָ�������ʱӦ�ðѷָ���д�ɷŵ��������У���$awk -F'[: ]' '{print $1,$3}' test����ʾ�Կո���ð�ź�tab��Ϊ�ָ�����
�������ķָ���Ĭ����һ���ո�����OFS�С���$ awk -F: '{print $1,$5}' test��$1��$5���Ķ��ž���OFS��ֵ��
һ��ͨ�õ�Ԫ�ַ����Ͳ����ˣ��ɲο��ҵ�Sed��Grepѧϰ�ʼǡ����¼�����gawkר�õģ����ʺ�unix�汾��awk��
- Y
-
ƥ��һ�����ʿ�ͷ����ĩβ�Ŀ��ַ�����
- B
-
ƥ�䵥���ڵĿ��ַ�����
- <
-
ƥ��һ�����ʵĿ�ͷ�Ŀ��ַ�����ê����ʼ��
- >
-
ƥ��һ�����ʵ�ĩβ�Ŀ��ַ�����ê��ĩβ��
- w
-
ƥ��һ����ĸ�������ɵĵ��ʡ�
- W
-
ƥ��һ������ĸ�������ɵĵ��ʡ�
- ��
-
ƥ���ַ�����ͷ��һ�����ַ�����
- '
-
ƥ���ַ���ĩβ��һ�����ַ�����
�ɲο��ҵ�Grepѧϰ�ʼ�
�����ڼ�¼��������ƥ����������ʽ����$ awk '$1 ~/^root/' test����ʾtest�ļ���һ������root��ͷ���С�
conditional expression1 ? expression2: expression3�����磺$ awk '{max = {$1 > $3} ? $1: $3: print max}' test��������һ�������ڵ���������$1��ֵ��max������$3��ֵ��max��
$ awk '$1 + $2 < 100' test��������һ�͵ڶ��������Ӵ���100������ӡ��Щ�С�
$ awk '$1 > 5 && $2 < 10' test,������һ��������5�����ҵڶ�����С��10������ӡ��Щ�С�
��Χģ��ƥ���ӵ�һ��ģ���ĵ�һ�γ��ֵ��ڶ���ģ���ĵ�һ�γ���֮�������С�������һ��ģ��û���֣���ƥ�䵽��ͷ��ĩβ����$ awk '/root/,/mysql/' test����ʾroot��һ�γ��ֵ�mysql��һ�γ���֮���������С�
1 $ cat /etc/passwd | awk -F: ' 2 NF != 7{ 3 printf("line %d,does not have 7 fields:%s ",NR,$0)} 4 $1 !~ /[A-Za-z0-9]/{printf("line %d,non alpha and numeric user id:%d: %s ,NR,$0)} 5 $2 == "*" {printf("line %d, no password: %s ",NR,$0)}'
-
$ awk '/^(no|so)/' test-----��ӡ������ģʽno��so��ͷ���С�
-
$ awk '/^[ns]/{print $1}' test-----������¼��n��s��ͷ���ʹ�ӡ������¼��
-
$ awk '$1 ~/[0-9][0-9]$/(print $1}' test-----������һ�������������ֽ����ʹ�ӡ������¼��
-
$ awk '$1 == 100 || $2 < 50' test-----������һ��������100���ߵڶ�����С��50������ӡ���С�
-
$ awk '$1 != 10' test-----������һ������10�ʹ�ӡ���С�
-
$ awk '/test/{print $1 + 10}' test-----������¼������������ʽtest������һ������10����ӡ������
-
$ awk '{print ($1 > 5 ? "ok "$1: "error"$1)}' test-----������һ��������5����ӡ�ʺź����ı���ʽֵ��������ӡð�ź����ı���ʽֵ��
-
$ awk '/^root/,/^mysql/' test----��ӡ����������ʽroot��ͷ�ļ�¼������������ʽmysql��ͷ�ļ�¼��Χ�ڵ����м�¼�������ҵ�һ���µ���������ʽroot��ͷ�ļ�¼����������ӡֱ����һ������������ʽmysql��ͷ�ļ�¼Ϊֹ�������ļ�ĩβ��
-
��awk�У���������Ҫ�����Ϳ���ֱ��ʹ�ã��������Ϳ��������ֻ��ַ�����
-
��ֵ��ʽ��Variable = expression����$ awk '$1 ~/test/{count = $2 + $3; print count}' test,��ʽ��������,awk��ɨ����һ������һ��testƥ�䣬�Ͱѵڶ�������ֵ���ϵ���������ֵ�����ѽ�����ֵ������count��������ӡ������
-
awk�������������и�������ֵ��Ȼ������������������awk�ű�����$ awk -F: -f awkscript month=4 year=2004 test����ʽ��month��year�����Զ����������ֱ𱻸�ֵΪ4��2004����awk�ű��У���Щ����ʹ�������������ڽű��н�����һ����ע�⣬��������ǰ������test����ô��BEGIN�����еı����Ͳ��ܱ�ʹ�á�
-
������Ҳ�ɱ���ֵ���ģ���$ awk '{$2 = 100 + $1; print }' test,��ʽ��ʾ�������ڶ������ڣ�awk����������ʽ100��$1��ֵ�������丳ֵ��$2�������ڶ��������ڣ����ñ���ʽ��ֵ����$2ԭ����ֵ�������磺$ awk '$1 == "root"{$1 ="test";print}' test��������һ������ֵ�ǡ�root������������ֵΪ��test����ע�⣬�ַ���һ��Ҫ��˫���š�
-
�ڽ�������ʹ�á������б���ǰ�����г������ھٸ�����˵��һ�¡�$ awk -F: '{IGNORECASE=1; $1 == "MARY"{print NR,$1,$2,$NF}'test����IGNORECASE��Ϊ1�������Դ�Сд����ӡ��һ������mary�ļ�¼������һ���ڶ�����������һ������
BEGINģ���������Ŷ����飬������������awk�����κ������ļ�֮ǰִ�С�������������û���κ������������½��в��ԡ���ͨ�������ı��ڽ�������ֵ����OFS,RS��FS�ȣ��Լ���ӡ���⡣�磺$ awk 'BEGIN{FS=":"; OFS=" "; ORS=" "}{print $1,$2,$3} test����ʽ��ʾ���ڴ��������ļ���ǰ�����ָ���(FS)����Ϊð�ţ������ļ��ָ���(OFS)������Ϊ�Ʊ�����������¼�ָ���(ORS)������Ϊ�������з���$ awk 'BEGIN{print "TITLE TEST"}ֻ��ӡ���⡣
END��ƥ���κε������ļ�������ִ�ж������е����ж������������������ļ��������ɺ���ִ�С���$ awk 'END{print "The number of records is" NR}' test����ʽ����ӡ���б������ļ�¼����
-
awk��ʹ��shell���ض����������ض����������磺$ awk '$1 = 100 {print $1 > "output_file" }' test����ʽ��ʾ������һ������ֵ����100��������������output_file�С�Ҳ������>>���ض������������������ļ���ֻ���Ӳ�����
-
�����ض������õ�getline������getline�ӱ����롢�ܵ����ߵ�ǰ���ڴ������ļ�֮�������������ļ��������롣������������������һ�е����ݣ�����NF,NR��FNR���ڽ�������ֵ�������õ�һ����¼��getline��������1�����������ļ���ĩβ�ͷ���0���������ִ��������������ļ�ʧ�ܣ��ͷ���-1���磺
$ awk 'BEGIN{ "date" | getline d; print d}' test��ִ��linux��date�����ͨ���ܵ�������getline��Ȼ���ٰ�������ֵ���Զ�������d������ӡ����
$ awk 'BEGIN{"date" | getline d; split(d,mon); print mon[2]}' test��ִ��shell��date�����ͨ���ܵ�������getline��Ȼ��getline�ӹܵ��ж�ȡ�������븳ֵ��d��split�����ѱ���dת��������mon��Ȼ����ӡ����mon�ĵڶ���Ԫ�ء�
$ awk 'BEGIN{while( "ls" | getline) print}'������ls���������ݸ�geline��Ϊ���룬ѭ��ʹgetline��ls�������ж�ȡһ�У���������ӡ����Ļ������û�������ļ�����ΪBEGIN���ڴ��������ļ�ǰִ�У����Կ��Ժ��������ļ���
$ awk 'BEGIN{printf "What is your name?"; getline name < "/dev/tty" } $1 ~name {print "Found" name on line ", NR "."} END{print "See you," name "."} test������Ļ�ϴ�ӡ��What is your name?",���ȴ��û�Ӧ�𡣵�һ���������Ϻ���getline�������ն˽��ո������룬�������������Զ�������name�С�������һ����ƥ������name��ֵ��print�����ͱ�ִ�У�END����ӡSee you��name��ֵ��
$ awk 'BEGIN{while (getline < "/etc/passwd" > 0) lc++; print lc}'��awk�����ж�ȡ�ļ�/etc/passwd�����ݣ��ڵ����ļ�ĩβǰ��������lcһֱ���ӣ�����ĩβʱ����ӡlc��ֵ��ע�⣬�����ļ������ڣ�getline����-1�����������ļ���ĩβ�ͷ���0����������һ�У��ͷ���1���������� while (getline < "/etc/passwd")���ļ������ڵ������½���������ѭ������Ϊ����-1��ʾ���档
-
������awk�д���һ���ܵ�����ͬһʱ��ֻ����һ���ܵ����ڡ�ͨ��close()�ɹرչܵ����磺$ awk '{print $1, $2 | "sort" }' test END {close("sort")}��awd��print����������ͨ���ܵ���Ϊlinux����sort������,END��ִ�йرչܵ�������
-
system����������awk��ִ��linux������磺$ awk 'BEGIN{system("clear")'��
-
fflush��������ˢ������������������û�в�������ˢ�±������Ļ������������Կ��ַ���Ϊ��������fflush(""),��ˢ�������ļ��ܵ���������������
awk�е����������Ǵ�C�����н��������ģ��ɿ��Ƴ��������̡�
��ʽ��
{if (expression){
statement; statement; ...
}
}
$ awk '{if ($1 <$2) print $2 "too high"}' test��������һ����С�ڵڶ���������ӡ��
$ awk '{if ($1 < $2) {count++; print "ok"}}' test.������һ����С�ڵڶ���������count��һ������ӡok��
��ʽ��
{if (expression){
statement; statement; ...
}
else{
statement; statement; ...
}
}
$ awk '{if ($1 > 100) print $1 "bad" ; else print "ok"}' test������$1����100����ӡ$1 bad,������ӡok��
$ awk '{if ($1 > 100){ count++; print $1} else {count--; print $2}' test������$1����100����count��һ������ӡ$1������count��һ������ӡ$1��
-
awk������ѭ��:whileѭ����forѭ����special forѭ����
-
$ awk '{ i = 1; while ( i <= NF ) { print NF,$i; i++}}' test�������ij�ʼֵΪ1����iС�ڿɵ���NF(��¼�����ĸ���),��ִ�д�ӡ���䣬��i����1��ֱ��i��ֵ����NF.
-
$ awk '{for (i = 1; i<NF; i++) print NF,$i}' test������ͬ�ϡ�
-
breadkcontinue���䡣break��������������������������ѭ����continue���������������������º��Ժ��������䣬ֱ�ӷ���ѭ���Ķ��ˡ��磺
{for ( x=3; x<=NF; x++) if ($x<0){print "Bottomed out!"; break}} {for ( x=3; x<=NF; x++) if ($x==0){print "Get next item"; continue}} -
next�����������ļ��ж�ȡһ�У�Ȼ����ͷ��ʼִ��awk�ű����磺
{if ($1 ~/test/){next} else {print} } -
exit�������ڽ���awk���������Թ�END�顣�˳�״̬Ϊ0�����ɹ�������ֵ��ʾ������
awk�е��������±����������ֺ���ĸ����Ϊ�������顣
-
�ñ�����Ϊ�����±ꡣ�磺$ awk {name[x++]=$2};END{for(i=0;i<NR;i++) print i,name[i]}' test������name�е��±���һ���Զ�������x��awk��ʼ��x��ֵΪ0����ÿ��ʹ�ú�����1���ڶ�������ֵ������name�����ĸ���Ԫ�ء���ENDģ���У�forѭ��������ѭ���������飬���±�Ϊ0��Ԫ�ؿ�ʼ����ӡ��Щ�洢�������е�ֵ����Ϊ�±��ǹؽ��֣���������һ����0��ʼ�����Դ��κ�ֵ��ʼ��
-
special forѭ�����ڶ�ȡ���������е�Ԫ�ء���ʽ���£�
{for (item in arrayname){ print arrayname[item] } }$ awk '/^tom/{name[NR]=$1}; END{for(i in name){print name[i]}}' test����ӡ��ֵ������Ԫ�ء���ӡ��˳���������ġ� -
���ַ�����Ϊ�±ꡣ�磺count["test"]
-
����ֵ��Ϊ�������±ꡣһ���µ�forѭ����ʽ��for (index_value in array) statement����:$ awk '{count[$1]++} END{for(name in count) print name,count[name]}' test�������佫��ӡ$1���ַ������ֵĴ������������Ե�һ����������count���±꣬��һ�����仯�������ͱ仯��
-
delete��������ɾ������Ԫ�ء��磺$ awk '{line[x++]=$1} END{for(x in line) delete(line[x])}' test������������line���ǵ�һ������ֵ�����м�¼�������ɺ���special forѭ����ɾ��ÿһ��Ԫ�ء�
-
sub����ƥ����¼������������ߵ����ַ�������������ʽ�������滻�ַ����滻��Щ�ַ���������û��ָ��Ŀ���ַ�����Ĭ��ʹ��������¼���滻ֻ�����ڵ�һ��ƥ����ʱ��ʽ���£�
sub (regular expression, substitution string): sub (regular expression, substitution string, target string)ʵ����
$ awk '{ sub(/test/, "mytest"); print }' testfile $ awk '{ sub(/test/, "mytest"); $1}; print }' testfile��һ��������������¼��ƥ�䣬�滻ֻ�����ڵ�һ��ƥ�䷢����ʱ������Ҫ�������ļ��н���ƥ����Ҫ�õ�gsub
�ڶ���������������¼�ĵ�һ�����н���ƥ�䣬�滻ֻ�����ڵ�һ��ƥ�䷢����ʱ����
-
gsub����������sub�������������ĵ��н���ƥ�䡣��ʽ���£�
gsub (regular expression, substitution string) gsub (regular expression, substitution string, target string)ʵ����
$ awk '{ gsub(/test/, "mytest"); print }' testfile $ awk '{ gsub(/test/, "mytest"), $1 }; print }' testfile��һ�������������ĵ���ƥ��test��ƥ���Ķ����滻��mytest��
�ڶ��������������ĵ��ĵ�һ������ƥ�䣬����ƥ���Ķ����滻��mytest��
-
index�����������ַ�����һ�α�ƥ����λ�ã�ƫ������λ��1��ʼ����ʽ���£�
index(string, substring)
ʵ����
$ awk '{ print index("test", "mytest") }' testfileʵ������test��mytest��λ�ã�����Ӧ����3��
-
length�������ؼ�¼���ַ�������ʽ���£�
length( string ) lengthʵ����
$ awk '{ print length( "test" ) }' $ awk '{ print length }' testfile��һ��ʵ������test�ַ����ij��ȡ�
�ڶ���ʵ������testfile�ļ��е�����¼���ַ�����
-
substr�������ش�λ��1��ʼ�����ַ���������ָ�����ȳ���ʵ�ʳ��ȣ��ͷ��������ַ�������ʽ���£�
substr( string, starting position ) substr( string, starting position, length of string )ʵ����
$ awk '{ print substr( "hello world", 7,11 ) }'������ȡ��world���ַ�����
-
match�����������ַ�������������ʽλ�õ������������Ҳ���ָ������������ʽ��0��match�����������ڽ�����RSTARTΪ�ַ��������ַ����Ŀ�ʼλ�ã�RLENGTHΪ�����ַ���ĩβ���ַ�������substr��������Щ��������ȡ�ַ�����������ʽ���£�
match( string, regular expression )
ʵ����
$ awk '{start=match("this is a test",/[a-z]+$/); print start}' $ awk '{start=match("this is a test",/[a-z]+$/); print start, RSTART, RLENGTH }'��һ��ʵ����ӡ������Сд�ַ���β�Ŀ�ʼλ�ã�������11��
�ڶ���ʵ������ӡRSTART��RLENGTH������������11(start)��11(RSTART)��4(RLENGTH)��
-
toupper��tolower�����������ַ�����С����ת�����ù���ֻ��gawk����Ч����ʽ���£�
toupper( string ) tolower( string )ʵ����
$ awk '{ print toupper("test"), tolower("TEST") }' -
split�����ɰ������ķָ������ַ����ָ�Ϊһ�����顣�����ָ���û�ṩ����ǰFSֵ���зָ��ʽ���£�
split( string, array, field separator ) split( string, array )ʵ����
$ awk '{ split( "20:18:00", time, ":" ); print time[2] }'������ʱ�䰴ð�ŷָtime�����ڣ�����ʾ�ڶ�������Ԫ��18��
-
systime�������ش�1970��1��1�տ�ʼ����ǰʱ��(��������)������������ʽ���£�
systime()
ʵ����
$ awk '{ now = systime(); print now }' -
strftime����ʹ��C���е�strftime������ʽ��ʱ�䡣��ʽ���£�
systime( [format specification][,timestamp] )
Table 3. ���ں�ʱ����ʽ˵����
��ʽ ���� %a ���ڼ�����д(Sun) %A ���ڼ�������д��(Sunday) %b ��������д(Oct) %B ����������д��(October) %c �������ں�ʱ�� %d ʮ�������� %D ���� 08/20/99 %e ���ڣ�����ֻ��һλ�Ჹ��һ���ո� %H ��ʮ���Ʊ�ʾ24Сʱ��ʽ��Сʱ %I ��ʮ���Ʊ�ʾ12Сʱ��ʽ��Сʱ %j ��1��1����һ���еĵڼ��� %m ʮ���Ʊ�ʾ���·� %M ʮ���Ʊ�ʾ�ķ��� %p 12Сʱ��ʾ��(AM/PM) %S ʮ���Ʊ�ʾ���� %U ʮ���Ʊ�ʾ��һ���еĵڼ�������(��������Ϊһ�����ڵĿ�ʼ) %w ʮ���Ʊ�ʾ�����ڼ�(��������0) %W ʮ���Ʊ�ʾ��һ���еĵڼ�������(����һ��Ϊһ�����ڵĿ�ʼ) %x �������ñ�������(08/20/99) %X �������ñ���ʱ��(12��00��00) %y ��λ���ֱ�ʾ����(99) %Y ��ǰ�·� %Z ʱ��(PDT) %% �ٷֺ�(%) ʵ����
$ awk '{ now=strftime( "%D", systime() ); print now }' $ awk '{ now=strftime("%m/%d/%y"); print now }'
- ת����ע����Դ��ITѧϰ�� ��ַ��http://www.t086.com/ �����������Ƽ�������
- �ر������� ��վ�������ر�������ֹת�ص�ר�������������¿�������ת�أ���������ע��������ԭʼ���ߡ����°�Ȩ������ԭʼ�������С����ڱ���վת�����µĸ��˺���վ�����DZ�ʾ������л�⡣������վת�ص������а�Ȩ��������ϵ���ǣ����ǻᾡ�����Ը�����
- �������е���ɫ
- �������ж�IP��ַ��A��B���C��
- ������ϵ��Ц�� (ʷ����ȫ��
- ��Google���������ŵ���ͨv4.0
- ���ٶ�ͳ��URL��hm������utm�����Ķ�Ӧ��ϵ
- ���������ԡ���װ Windows XP ����ϵͳ��ͼ��ȫ����
- ��ƻ������MACbook Air���ݼ���ȫ
- ��Linux��ʹ��host��dig��nslookup��ѯDNS
- �����Լ���VPS�Google��������
- ��С�ڴ�VPS֮Nginx+PHP-fpm�߸����Ż���ѹ�����Է���
- ������������������̸�����ɶ��ر�
- ��������������ѡʳƷ����2020�ļ��ȵ�Ͷ�ʲ��Ժ���������
- �����ڵ�����֤50���ƴ�50����ָ֤�������Ĺ���
- ����֤50����Щ��Ʊ_��֤50Ȩ����������
- ������300����֤50����֤500��ָ��2019���ڶ��ζ��ڵ���������
- ������300��ֵ/�ɳ�ָ�����Ʒ����������й�ƽ��Ȩ���½�
- ����ָ֤��������֤50��ָ��������
- ����ָ֤��������֤����ָ��������
- ����ָ֤��������֤100ָ��������
- ����ָ֤����������300ָ��������