#read one file line by line for line in $(cat test1.txt); do echo $line ; done; #while read split line by space while read line do for word in $line do echo $word done; done <test1.txt #string split or substring input=type=abcdefg echo $input; #get a…
In Java 8, you can use Files.lines to read file as Stream. c://lines.txt – A simple text file for testing line1 line2 line3 line4 line5 1. Java 8 Read File + Stream TestReadFile.java package com.mkyong.java8; import java.io.IOException; import java.n…
shell result from cmdline echo $? if 0 then success ;else failure (shell 执行每部返回值,rm -rf 错误,打包不能覆盖) 解决sudo: sorry, you must have a tty to run sudo 前几天遇到一个问题,在一个终端中调用另一个shell,始终是无法执行的,后来捕捉到报错信息为sudo: sorry, you must have a tty to run sudo,后来,在网上了解到可以…
在处理的文件comment有如下格式: ............................ xxx.xxx.10.59 db1059 mynbdpdatadb.idc4. dbname R620 master IDC2 Y Y Y xxx.xxx.11.59 db1159 mynbdpdatadw.idc4. dbname R620 slave IDC1 Y Y Y xxx.xxx.10.90 db1090 - dbname1,dbname2,dbname3 R620 slave IDC3…