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

  • 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
主站蜘蛛池模板: 轮台县| 新龙县| 措美县| 望奎县| 涿鹿县| 辽宁省| 东平县| 边坝县| 溧阳市| 浮山县| 昌都县| 南涧| 东兴市| 化德县| 富平县| 金堂县| 永昌县| 剑川县| 竹山县| 九江市| 清流县| 双峰县| 万山特区| 肥东县| 宿松县| 广宗县| 景宁| 武义县| 宁南县| 赣榆县| 沙田区| 天全县| 商都县| 长垣县| 墨玉县| 神池县| 思南县| 封开县| 新田县| 栾川县| 嘉黎县|