官术网_书友最值得收藏!

  • Bash Cookbook
  • Ron Brash Ganesh Naik
  • 136字
  • 2021-07-23 19:17:36

Getting ready

Let's get ready for the exercise by creating some data sets which mimic common daily problems:

$ rm -rf testdata; mkdir -p testdata
$ echo "Bob, Jane, Naz, Sue, Max, Tom$" > testdata/garbage.csv
$ echo "Zero, Alpha, Beta, Gama, Delta, Foxtrot#" >> testdata/garbage.csv
$ echo "1000,Bob,Green,Dec,1,1967" > testdata/employees.csv
$ echo "2000,Ron,Brash,Jan,20,1987" >> testdata/employees.csv
$ echo "3000,James,Fairview,Jul,15,1992" >> testdata/employees.csv

Using these two CSVs, we are going to:

  • Remove the extra spaces on the first two lines of garbage.csv
  • Remove the last character from each line in garbage.csv
  • Change the case of each character to uppercase in the first two lines of garbage.csv
  • Replace Bob with Robert in employees.csv
  • Insert a # at the beginning of each line in employees.csv
  • Remove the exact date of birth column/field in each line of employees.csv
主站蜘蛛池模板: 家居| 独山县| 潼关县| 光山县| 潮安县| 涪陵区| 舒城县| 诸暨市| 嘉定区| 宝山区| 准格尔旗| 铁岭县| 民丰县| 凤翔县| 怀化市| 深州市| 罗平县| 漳平市| 武山县| 南川市| 黄大仙区| 绥中县| 项城市| 萨迦县| 崇文区| 玉环县| 略阳县| 延庆县| 商都县| 莱阳市| 甘洛县| 佛教| 南陵县| 丘北县| 嘉鱼县| 鹤山市| 卓资县| 繁峙县| 土默特右旗| 马尔康县| 平武县|