One way is to useCatand anti-quote
PS: Anti-quotes play the role of command substitution in Linux. Command substitution refers to the ability of the shell to interpolate the standard output of a command anywhere on a command line.
The input format is as follows:
20151207 [email protected]. com
20151225 155581558905678
As follows
The internal field delimiter (Internal field Separator, IFS) is an important concept in shell scripting. IFS is an environment variable that stores delimiters. It is the default bounding string used by the current shell environment, for example: data= "name, sex, Rollno, location" #我们可以使用IFS读取变量中的每一个条目 oldifs= $IFS IFS = "," for item in $data does echo item: $item done ifs= $oldIFS
Count=0for line in ' Cat Data.txt ' does ifs=$ ' for value in $line do count=$[$count +1] echo $ Value Done#echo $linedone
one is to use a pipe or redirect
' | ' Represents a pipe connection, and a pipeline in Linux is a special file descriptor.
Pipeline is a very important way of communication in Linux, is to connect the output of one program directly to the input of another program, often said pipe refers to the nameless pipe, the nameless pipe can only be used in the relationship between the process, which is its most important difference with the famous pipe.
A well-known pipe called Named pipe or FIFO (first-in, in-out) can be created with function Mkfifo ().
# second Examplecat data.txt | While read Linedo-var in $line do
Linux shell read file by line processing