Fortune Telling Collection - Fortune-telling birth date - Linux operator Linux or operator

Linux operator Linux or operator

A detailed explanation of awk command in linux?

AWK is a language for processing text files and a powerful tool for text analysis.

AWK got its name because it adopted the initials of three founders, AlfredAho, PeterWeinberger and BrianKernighan.

grammar

awk'script'var=valuefile

or

Awk-fscriptfilevar = value file

Description of option parameters:

-Ffsor-field delimiter

Specifies the delimiter of the input file, where fs is a string or a regular expression, such as -F:.

-vvar=valueor - asignvar=value

Assign user-defined variables.

-fscriptfileor-file script file

Read awk command from script file.

-mfnnnand-mrnnn

Set an inherent limit on the value of nnn, and the -mf option limits the maximum number of blocks allocated to nnn; The -mr option limits the maximum number of records. These two functions are extended functions of Bell Laboratories awk, which are not applicable in standard awk.

-Wcompactor - compat,-wtradional or-traditional

Run awk in compatibility mode. So gawk behaves exactly like standard awk, and all awk extensions are ignored.

-Wcopyleftor-copyleft,-wcopyrighter-all rights reserved.

Print short copyright information.

-Whelpor-help, -Wusageor-usage

Print all awk options and a short description of each option.

-Wlintor - lint

Print a warning that the structure cannot be ported to a traditional unix platform.

-Wlint-old or lint-old

Print warnings about structures that cannot be ported to traditional unix platforms.

-Wposix

Open compatibility mode. However, there are the following restrictions, which are not recognized: /x, func keyword, func, escape sequence, when fs is a space, the new line field separator is used; Operators * * and * = cannot replace and =;; Fflush is invalid.

-Wre-intervalor-re-inter reval

Interval regular expressions are allowed, referring to (Posix character class in grep), such as bracket expressions].

-wsource program-textor-source program-text

Using program-text as the source code, you can mix the -f commands.

-Wversionor - version

Print the version of the error report information.

Linuxshell command, -d?

Part is a judgment expression, and -d means judging whether it is a directory. It is a logical AND operator (similar to C syntax). The following statement will be executed only if the previous judgment holds (returning logical truth). In a word, it means: if /root/Desktop/ is a directory, execute chmod777 /root/Desktop/download. If /root/desktop/ is not a directory (the directory does not exist), execute chmod777/root/ desktop/download. The desktop is actually dealing with the situation that the desktop is in English and Chinese.

How to convert numbers and characters in Shell?

Double quotation marks will do. var = 1if; thenechoStringmatch! elseechoNotmatch! Fi, this converts the comparison of numbers into the comparison of strings. (Numbers are compared with the -eq operator. )

Var 1=$var, so it is a transformation.