Shell reads the row and column of a file

I want to perform frequent operations on a file. To obtain the values of different columns in each row, I know the method isWhile read lineDoEcho $ Line | awk '{print $1}' # obtain the value of the first column in each rowEcho $ Line | awk '{print $2

Shell script syntax

Shell script:#! /Bin/Bash must pass the first line #! To specify the Current Shell I. variables:"": Allows you to reference values of other variables using the $ symbol.'': Other variables cannot be referenced. $ is considered as a normal

Redirection of input and output in Shell

/* Is also the online answer. I don't know where to find it ......*/   In the Linux Shell environment, input and output redirection is supported, expressed by symbols . 0, 1, and 2 indicate the standard input, standard output, and standard error

Recommendation: APIs for file path operations in Shell

RecommendedArticle: APIS for file path operations in Shell Http://www.cnblogs.com/fangkm/archive/2009/04/15/1436674.html   I wanted to sort it out by myself, but I found the above article by Google according to the title of the phenomenon, and I

AIX shell log pressure and Deletion

#/Bin/sh # Add By zhoujf. Free log file; Dir_list = "/product1/port/bin/ocs_subscriber_import/back" Log_list = "* 201 *. unl" Gz_day = 3Del_day = 30Core_day = 7 Cur_time = 'date + "% Y % m % d % t "'Echo "start at [$ cur_time]" For dir in $

Compare shell strings and determine whether the string is a number

This post was last edited by ps49324955Integer comparison-------------------------------------------------------------EQ equals to, for example, if ["$ A"-EQ "$ B"]-Ne is not equal to, for example, if ["$ A"-ne "$ B"]-GT is greater than, for example,

Example of executing SQL in Shell

Dbstr = "Busi/xxxx @ CRM" Send_sms () {Pcount = 0For phone in $ phonelistDoTime = "inf" 'date + '% Y % m % d % H % m % s''Comm_sn = "$ {time} $1 $ {pcount }"Echo "comm_sn =$ {comm_sn }"SQL = "insert into Busi. log_sms_pay values ('"$ comm_sn"',

Usage of shell -- tr

TR is used to delete control characters in a file or convert characters.Syntax: TR [-C/D/S/T] [set1] [set2]Set1: Character Set 1Set2: Character Set 2-C: complement. Use set2 to replace characters not included in set1.-D: delete all characters in set1

Floating Point calculator in Linux Shell learning-Bash

Linux bash calculator is easy to use, at least it is easier to be lazy. How: 1. Use the command line# Scale indicates the exact number of digits of a floating point.[Root @ hostname ~] # BCBC 1.06Copyright 1991-1994,199 7, 1998,200 0 Free

Object-oriented shell scripts

Do you still remember the regular expression that used to calculate prime numbers? The world of programming is so interesting that you will always be able to see something special. Have you ever thought that you can put your variables and functions

Some self-written Linux Shell functions

1. Get user input.The parameter is the regular expression that is correctly checked by the input prompt, and the default value is entered.ReturnThe correct user input is returned. Function get_input (){Prompt = $1RegEx = $2Default = $3If ["x $

Compile a simple shell command parser

Compile a simple shell command parser Environment: RedHat 9.0 kernel 2.4.20 VI document editor 6.1.320 GCC 3.2.2-5   Steps:   Step 2: Write the simplest shell command interpreter. This program is taken from apue Example 1-5. The command cannot

Shell sorting of Reading Notes

Environment: [Lanux @ localhost -- debug --] $ uname-SRLinux 2.6.34.7-61. fc13.i686. PAE[Lanux @ localhost -- debug -- 15:32] $ rpm-Qa | grep anjutaAnjuta-doc-2.30.2.1-1.fc13.noarchAnjuta-2.30.2.1-1.fc13.i686Anjuta-devel-2.30.2.1-1.fc13.i686[Lanux @

Automatically back up SVN repository using shell

This script is used to automatically back up version libraries under the svn directory and traverse the libraries through awk. The advantage of this is that when someone adds a new version library, there is no need to change the code, the program

Three types of shell script condition judgment (Memo)

String comparison: Result String1 = string2 string1 equals string2: True, otherwise false String1! = String2 string1 equals to string2: false, otherwise true -When n string is not equal to NULL: True, otherwise false -Z string when string is null:

Start the shell Environment

6.3 start the shell Environment The init_post function comes from the 814 rows of the same file:   811/* This is a non _ init function. force it to be noinline otherwise gcc812 * makes it inline to Init () and it becomes part of init. Text

Shell script notes

#! /Bin/sh# The first line is to tell the system who will execute this dumb. $ ## Number of parameters transferred to the script$ # ID of the current process during script running, often used as the suffix of temporary variables, such as haison. $$!

Shell splits strings into Arrays

#! /Bin/bash A = "one, two, three, four" # To split $ A, you can: Old_ifs = "$ ifs" Ifs = "," Arr = ($) Ifs = "$ old_ifs" For s in $ {arr [@]} Do Echo "$ S" Done The above code will output One Two Three Four Arr = ($ A) is used to

Shell basic notes

Note: No space is allowed between the left and right sides of "=". The semicolon program 1 # is not required at the end of the bash statement #! /Bin/sh # echo somethingecho "Hello World" Echo "Hello !! "CD/root/export topmkdir./ABC Program 2,

Shell size brackets

There is no doubt about the strength of shell, which makes it easier for us to confuse us. For example, I have always thought that I am smart and cannot tell you clearly. In Shell, Parentheses, braces, and variables in parentheses are used as

Total Pages: 541 1 .... 501 502 503 504 505 .... 541 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.