Added hgignore and deleted the html files as they do not need to be tracked by hg now
authoramit@thunder
Tue, 02 Mar 2010 18:49:48 +0530
changeset 42 1f61ee485958
parent 41 e54725be4df6
child 43 134b87b382f5
Added hgignore and deleted the html files as they do not need to be tracked by hg now
.hgignore
SEESenv/web/hgbook/comments/p_list.py
SEESenv/web/html/ch1Introduction.html
SEESenv/web/html/ch2intro.html
SEESenv/web/html/ch3list_tuples.html
SEESenv/web/html/ch4strings_dicts.html
SEESenv/web/html/ch5func.html
SEESenv/web/html/ch6oop.html
SEESenv/web/html/ch7interim_assessment.html
SEESenv/web/html/ch8ult_module_plan.html
SEESenv/web/html/ch9Using_Linux_Tools.html
SEESenv/web/html/chn10session4.html
SEESenv/web/html/chn11Section_5.html
SEESenv/web/html/chn12index.html
sees.hook
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Tue Mar 02 18:49:48 2010 +0530
@@ -0,0 +1,3 @@
+syntax: regexp
+SEESenv/web/html/*.html
+SEESenv/web/hgbook/comments/p_list.py
--- a/SEESenv/web/hgbook/comments/p_list.py	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-p_list= {'ch12index': [], 'ch6oop': ['ch6oop_1', 'ch6oop_2', 'ch6oop_3', 'ch6oop_4', 'ch6oop_5', 'ch6oop_6'], 'ch9Using_Linux_Tools': ['ch9Using_Linux_Tools_1', 'ch9Using_Linux_Tools_2', 'ch9Using_Linux_Tools_3', 'ch9Using_Linux_Tools_4', 'ch9Using_Linux_Tools_5', 'ch9Using_Linux_Tools_6', 'ch9Using_Linux_Tools_7', 'ch9Using_Linux_Tools_8', 'ch9Using_Linux_Tools_9', 'ch9Using_Linux_Tools_a', 'ch9Using_Linux_Tools_b', 'ch9Using_Linux_Tools_c', 'ch9Using_Linux_Tools_d', 'ch9Using_Linux_Tools_e', 'ch9Using_Linux_Tools_f', 'ch9Using_Linux_Tools_10', 'ch9Using_Linux_Tools_11', 'ch9Using_Linux_Tools_12', 'ch9Using_Linux_Tools_13', 'ch9Using_Linux_Tools_14', 'ch9Using_Linux_Tools_15', 'ch9Using_Linux_Tools_16', 'ch9Using_Linux_Tools_17', 'ch9Using_Linux_Tools_18', 'ch9Using_Linux_Tools_19', 'ch9Using_Linux_Tools_1a', 'ch9Using_Linux_Tools_1b', 'ch9Using_Linux_Tools_1c', 'ch9Using_Linux_Tools_1d', 'ch9Using_Linux_Tools_1e', 'ch9Using_Linux_Tools_1f', 'ch9Using_Linux_Tools_20', 'ch9Using_Linux_Tools_21', 'ch9Using_Linux_Tools_22', 'ch9Using_Linux_Tools_23', 'ch9Using_Linux_Tools_24', 'ch9Using_Linux_Tools_25', 'ch9Using_Linux_Tools_26', 'ch9Using_Linux_Tools_27', 'ch9Using_Linux_Tools_28', 'ch9Using_Linux_Tools_29', 'ch9Using_Linux_Tools_2a', 'ch9Using_Linux_Tools_2b', 'ch9Using_Linux_Tools_2c', 'ch9Using_Linux_Tools_2d', 'ch9Using_Linux_Tools_2e', 'ch9Using_Linux_Tools_2f', 'ch9Using_Linux_Tools_30', 'ch9Using_Linux_Tools_31', 'ch9Using_Linux_Tools_32', 'ch9Using_Linux_Tools_33', 'ch9Using_Linux_Tools_34', 'ch9Using_Linux_Tools_35', 'ch9Using_Linux_Tools_36', 'ch9Using_Linux_Tools_37', 'ch9Using_Linux_Tools_38', 'ch9Using_Linux_Tools_39', 'ch9Using_Linux_Tools_3a', 'ch9Using_Linux_Tools_3b', 'ch9Using_Linux_Tools_3c', 'ch9Using_Linux_Tools_3d', 'ch9Using_Linux_Tools_3e', 'ch9Using_Linux_Tools_3f', 'ch9Using_Linux_Tools_40', 'ch9Using_Linux_Tools_41', 'ch9Using_Linux_Tools_42', 'ch9Using_Linux_Tools_43', 'ch9Using_Linux_Tools_44', 'ch9Using_Linux_Tools_45', 'ch9Using_Linux_Tools_46', 'ch9Using_Linux_Tools_47', 'ch9Using_Linux_Tools_48', 'ch9Using_Linux_Tools_49', 'ch9Using_Linux_Tools_4a', 'ch9Using_Linux_Tools_4b', 'ch9Using_Linux_Tools_4c', 'ch9Using_Linux_Tools_4d', 'ch9Using_Linux_Tools_4e', 'ch9Using_Linux_Tools_4f', 'ch9Using_Linux_Tools_50', 'ch9Using_Linux_Tools_51', 'ch9Using_Linux_Tools_52', 'ch9Using_Linux_Tools_53', 'ch9Using_Linux_Tools_54', 'ch9Using_Linux_Tools_55', 'ch9Using_Linux_Tools_56', 'ch9Using_Linux_Tools_57', 'ch9Using_Linux_Tools_58', 'ch9Using_Linux_Tools_59', 'ch9Using_Linux_Tools_5a', 'ch9Using_Linux_Tools_5b', 'ch9Using_Linux_Tools_5c', 'ch9Using_Linux_Tools_5d', 'ch9Using_Linux_Tools_5e', 'ch9Using_Linux_Tools_5f', 'ch9Using_Linux_Tools_60', 'ch9Using_Linux_Tools_61', 'ch9Using_Linux_Tools_62', 'ch9Using_Linux_Tools_63', 'ch9Using_Linux_Tools_64', 'ch9Using_Linux_Tools_65', 'ch9Using_Linux_Tools_66', 'ch9Using_Linux_Tools_67', 'ch9Using_Linux_Tools_68', 'ch9Using_Linux_Tools_69', 'ch9Using_Linux_Tools_6a', 'ch9Using_Linux_Tools_6b', 'ch9Using_Linux_Tools_6c', 'ch9Using_Linux_Tools_6d', 'ch9Using_Linux_Tools_6e', 'ch9Using_Linux_Tools_6f', 'ch9Using_Linux_Tools_70', 'ch9Using_Linux_Tools_71', 'ch9Using_Linux_Tools_72', 'ch9Using_Linux_Tools_73', 'ch9Using_Linux_Tools_74', 'ch9Using_Linux_Tools_75', 'ch9Using_Linux_Tools_76', 'ch9Using_Linux_Tools_77', 'ch9Using_Linux_Tools_78', 'ch9Using_Linux_Tools_79', 'ch9Using_Linux_Tools_7a', 'ch9Using_Linux_Tools_7b', 'ch9Using_Linux_Tools_7c', 'ch9Using_Linux_Tools_7d', 'ch9Using_Linux_Tools_7e', 'ch9Using_Linux_Tools_7f', 'ch9Using_Linux_Tools_80', 'ch9Using_Linux_Tools_81', 'ch9Using_Linux_Tools_82', 'ch9Using_Linux_Tools_83', 'ch9Using_Linux_Tools_84', 'ch9Using_Linux_Tools_85', 'ch9Using_Linux_Tools_86', 'ch9Using_Linux_Tools_87', 'ch9Using_Linux_Tools_88', 'ch9Using_Linux_Tools_89', 'ch9Using_Linux_Tools_8a', 'ch9Using_Linux_Tools_8b', 'ch9Using_Linux_Tools_8c', 'ch9Using_Linux_Tools_8d', 'ch9Using_Linux_Tools_8e', 'ch9Using_Linux_Tools_8f', 'ch9Using_Linux_Tools_90', 'ch9Using_Linux_Tools_91', 'ch9Using_Linux_Tools_92', 'ch9Using_Linux_Tools_93', 'ch9Using_Linux_Tools_94', 'ch9Using_Linux_Tools_95', 'ch9Using_Linux_Tools_96', 'ch9Using_Linux_Tools_97', 'ch9Using_Linux_Tools_98', 'ch9Using_Linux_Tools_99', 'ch9Using_Linux_Tools_9a', 'ch9Using_Linux_Tools_9b', 'ch9Using_Linux_Tools_9c', 'ch9Using_Linux_Tools_9d', 'ch9Using_Linux_Tools_9e', 'ch9Using_Linux_Tools_9f', 'ch9Using_Linux_Tools_a0', 'ch9Using_Linux_Tools_a1', 'ch9Using_Linux_Tools_a2', 'ch9Using_Linux_Tools_a3', 'ch9Using_Linux_Tools_a4', 'ch9Using_Linux_Tools_a5', 'ch9Using_Linux_Tools_a6', 'ch9Using_Linux_Tools_a7', 'ch9Using_Linux_Tools_a8', 'ch9Using_Linux_Tools_a9', 'ch9Using_Linux_Tools_aa', 'ch9Using_Linux_Tools_ab', 'ch9Using_Linux_Tools_ac', 'ch9Using_Linux_Tools_ad', 'ch9Using_Linux_Tools_ae', 'ch9Using_Linux_Tools_af', 'ch9Using_Linux_Tools_b0', 'ch9Using_Linux_Tools_b1', 'ch9Using_Linux_Tools_b2', 'ch9Using_Linux_Tools_b3', 'ch9Using_Linux_Tools_b4', 'ch9Using_Linux_Tools_b5', 'ch9Using_Linux_Tools_b6', 'ch9Using_Linux_Tools_b7', 'ch9Using_Linux_Tools_b8', 'ch9Using_Linux_Tools_b9', 'ch9Using_Linux_Tools_ba', 'ch9Using_Linux_Tools_bb', 'ch9Using_Linux_Tools_bc', 'ch9Using_Linux_Tools_bd', 'ch9Using_Linux_Tools_be', 'ch9Using_Linux_Tools_bf', 'ch9Using_Linux_Tools_c0', 'ch9Using_Linux_Tools_c1', 'ch9Using_Linux_Tools_c2', 'ch9Using_Linux_Tools_c3', 'ch9Using_Linux_Tools_c4', 'ch9Using_Linux_Tools_c5', 'ch9Using_Linux_Tools_c6', 'ch9Using_Linux_Tools_c7', 'ch9Using_Linux_Tools_c8', 'ch9Using_Linux_Tools_c9', 'ch9Using_Linux_Tools_ca', 'ch9Using_Linux_Tools_cb', 'ch9Using_Linux_Tools_cc', 'ch9Using_Linux_Tools_cd', 'ch9Using_Linux_Tools_ce', 'ch9Using_Linux_Tools_cf', 'ch9Using_Linux_Tools_d0', 'ch9Using_Linux_Tools_d1', 'ch9Using_Linux_Tools_d2', 'ch9Using_Linux_Tools_d3', 'ch9Using_Linux_Tools_d4', 'ch9Using_Linux_Tools_d5', 'ch9Using_Linux_Tools_d6', 'ch9Using_Linux_Tools_d7', 'ch9Using_Linux_Tools_d8', 'ch9Using_Linux_Tools_d9', 'ch9Using_Linux_Tools_da', 'ch9Using_Linux_Tools_db', 'ch9Using_Linux_Tools_dc', 'ch9Using_Linux_Tools_dd', 'ch9Using_Linux_Tools_de', 'ch9Using_Linux_Tools_df', 'ch9Using_Linux_Tools_e0', 'ch9Using_Linux_Tools_e1', 'ch9Using_Linux_Tools_e2', 'ch9Using_Linux_Tools_e3', 'ch9Using_Linux_Tools_e4', 'ch9Using_Linux_Tools_e5', 'ch9Using_Linux_Tools_e6', 'ch9Using_Linux_Tools_e7', 'ch9Using_Linux_Tools_e8', 'ch9Using_Linux_Tools_e9', 'ch9Using_Linux_Tools_ea', 'ch9Using_Linux_Tools_eb', 'ch9Using_Linux_Tools_ec', 'ch9Using_Linux_Tools_ed', 'ch9Using_Linux_Tools_ee', 'ch9Using_Linux_Tools_ef', 'ch9Using_Linux_Tools_f0', 'ch9Using_Linux_Tools_f1', 'ch9Using_Linux_Tools_f2', 'ch9Using_Linux_Tools_f3', 'ch9Using_Linux_Tools_f4', 'ch9Using_Linux_Tools_f5', 'ch9Using_Linux_Tools_f6', 'ch9Using_Linux_Tools_f7', 'ch9Using_Linux_Tools_f8', 'ch9Using_Linux_Tools_f9', 'ch9Using_Linux_Tools_fa', 'ch9Using_Linux_Tools_fb', 'ch9Using_Linux_Tools_fc', 'ch9Using_Linux_Tools_fd', 'ch9Using_Linux_Tools_fe', 'ch9Using_Linux_Tools_ff', 'ch9Using_Linux_Tools_100', 'ch9Using_Linux_Tools_101', 'ch9Using_Linux_Tools_102', 'ch9Using_Linux_Tools_103', 'ch9Using_Linux_Tools_104', 'ch9Using_Linux_Tools_105', 'ch9Using_Linux_Tools_106', 'ch9Using_Linux_Tools_107', 'ch9Using_Linux_Tools_108', 'ch9Using_Linux_Tools_109', 'ch9Using_Linux_Tools_10a', 'ch9Using_Linux_Tools_10b', 'ch9Using_Linux_Tools_10c', 'ch9Using_Linux_Tools_10d', 'ch9Using_Linux_Tools_10e', 'ch9Using_Linux_Tools_10f', 'ch9Using_Linux_Tools_110', 'ch9Using_Linux_Tools_111', 'ch9Using_Linux_Tools_112', 'ch9Using_Linux_Tools_113', 'ch9Using_Linux_Tools_114', 'ch9Using_Linux_Tools_115', 'ch9Using_Linux_Tools_116', 'ch9Using_Linux_Tools_117', 'ch9Using_Linux_Tools_118', 'ch9Using_Linux_Tools_119', 'ch9Using_Linux_Tools_11a', 'ch9Using_Linux_Tools_11b', 'ch9Using_Linux_Tools_11c', 'ch9Using_Linux_Tools_11d', 'ch9Using_Linux_Tools_11e', 'ch9Using_Linux_Tools_11f', 'ch9Using_Linux_Tools_120', 'ch9Using_Linux_Tools_121', 'ch9Using_Linux_Tools_122', 'ch9Using_Linux_Tools_123', 'ch9Using_Linux_Tools_124', 'ch9Using_Linux_Tools_125', 'ch9Using_Linux_Tools_126', 'ch9Using_Linux_Tools_127', 'ch9Using_Linux_Tools_128', 'ch9Using_Linux_Tools_129', 'ch9Using_Linux_Tools_12a', 'ch9Using_Linux_Tools_12b', 'ch9Using_Linux_Tools_12c', 'ch9Using_Linux_Tools_12d', 'ch9Using_Linux_Tools_12e', 'ch9Using_Linux_Tools_12f', 'ch9Using_Linux_Tools_130', 'ch9Using_Linux_Tools_131', 'ch9Using_Linux_Tools_132', 'ch9Using_Linux_Tools_133', 'ch9Using_Linux_Tools_134', 'ch9Using_Linux_Tools_135', 'ch9Using_Linux_Tools_136', 'ch9Using_Linux_Tools_137', 'ch9Using_Linux_Tools_138', 'ch9Using_Linux_Tools_139', 'ch9Using_Linux_Tools_13a', 'ch9Using_Linux_Tools_13b', 'ch9Using_Linux_Tools_13c', 'ch9Using_Linux_Tools_13d', 'ch9Using_Linux_Tools_13e', 'ch9Using_Linux_Tools_13f', 'ch9Using_Linux_Tools_140', 'ch9Using_Linux_Tools_141', 'ch9Using_Linux_Tools_142', 'ch9Using_Linux_Tools_143', 'ch9Using_Linux_Tools_144', 'ch9Using_Linux_Tools_145', 'ch9Using_Linux_Tools_146', 'ch9Using_Linux_Tools_147', 'ch9Using_Linux_Tools_148', 'ch9Using_Linux_Tools_149', 'ch9Using_Linux_Tools_14a', 'ch9Using_Linux_Tools_14b', 'ch9Using_Linux_Tools_14c', 'ch9Using_Linux_Tools_14d', 'ch9Using_Linux_Tools_14e', 'ch9Using_Linux_Tools_14f', 'ch9Using_Linux_Tools_150', 'ch9Using_Linux_Tools_151', 'ch9Using_Linux_Tools_152', 'ch9Using_Linux_Tools_153', 'ch9Using_Linux_Tools_154', 'ch9Using_Linux_Tools_155', 'ch9Using_Linux_Tools_156', 'ch9Using_Linux_Tools_157', 'ch9Using_Linux_Tools_158', 'ch9Using_Linux_Tools_159', 'ch9Using_Linux_Tools_15a', 'ch9Using_Linux_Tools_15b', 'ch9Using_Linux_Tools_15c', 'ch9Using_Linux_Tools_15d', 'ch9Using_Linux_Tools_15e', 'ch9Using_Linux_Tools_15f', 'ch9Using_Linux_Tools_160', 'ch9Using_Linux_Tools_161', 'ch9Using_Linux_Tools_162', 'ch9Using_Linux_Tools_163', 'ch9Using_Linux_Tools_164', 'ch9Using_Linux_Tools_165', 'ch9Using_Linux_Tools_166', 'ch9Using_Linux_Tools_167', 'ch9Using_Linux_Tools_168', 'ch9Using_Linux_Tools_169', 'ch9Using_Linux_Tools_16a', 'ch9Using_Linux_Tools_16b', 'ch9Using_Linux_Tools_16c', 'ch9Using_Linux_Tools_16d', 'ch9Using_Linux_Tools_16e', 'ch9Using_Linux_Tools_16f', 'ch9Using_Linux_Tools_170', 'ch9Using_Linux_Tools_171', 'ch9Using_Linux_Tools_172', 'ch9Using_Linux_Tools_173', 'ch9Using_Linux_Tools_174', 'ch9Using_Linux_Tools_175', 'ch9Using_Linux_Tools_176', 'ch9Using_Linux_Tools_177', 'ch9Using_Linux_Tools_178', 'ch9Using_Linux_Tools_179', 'ch9Using_Linux_Tools_17a', 'ch9Using_Linux_Tools_17b', 'ch9Using_Linux_Tools_17c', 'ch9Using_Linux_Tools_17d', 'ch9Using_Linux_Tools_17e', 'ch9Using_Linux_Tools_17f', 'ch9Using_Linux_Tools_180', 'ch9Using_Linux_Tools_181', 'ch9Using_Linux_Tools_182', 'ch9Using_Linux_Tools_183', 'ch9Using_Linux_Tools_184', 'ch9Using_Linux_Tools_185', 'ch9Using_Linux_Tools_186', 'ch9Using_Linux_Tools_187', 'ch9Using_Linux_Tools_188', 'ch9Using_Linux_Tools_189', 'ch9Using_Linux_Tools_18a', 'ch9Using_Linux_Tools_18b', 'ch9Using_Linux_Tools_18c', 'ch9Using_Linux_Tools_18d', 'ch9Using_Linux_Tools_18e', 'ch9Using_Linux_Tools_18f', 'ch9Using_Linux_Tools_190', 'ch9Using_Linux_Tools_191', 'ch9Using_Linux_Tools_192', 'ch9Using_Linux_Tools_193', 'ch9Using_Linux_Tools_194', 'ch9Using_Linux_Tools_195', 'ch9Using_Linux_Tools_196', 'ch9Using_Linux_Tools_197', 'ch9Using_Linux_Tools_198', 'ch9Using_Linux_Tools_199', 'ch9Using_Linux_Tools_19a', 'ch9Using_Linux_Tools_19b', 'ch9Using_Linux_Tools_19c', 'ch9Using_Linux_Tools_19d', 'ch9Using_Linux_Tools_19e', 'ch9Using_Linux_Tools_19f', 'ch9Using_Linux_Tools_1a0', 'ch9Using_Linux_Tools_1a1', 'ch9Using_Linux_Tools_1a2', 'ch9Using_Linux_Tools_1a3', 'ch9Using_Linux_Tools_1a4', 'ch9Using_Linux_Tools_1a5', 'ch9Using_Linux_Tools_1a6', 'ch9Using_Linux_Tools_1a7', 'ch9Using_Linux_Tools_1a8', 'ch9Using_Linux_Tools_1a9', 'ch9Using_Linux_Tools_1aa', 'ch9Using_Linux_Tools_1ab', 'ch9Using_Linux_Tools_1ac', 'ch9Using_Linux_Tools_1ad', 'ch9Using_Linux_Tools_1ae', 'ch9Using_Linux_Tools_1af', 'ch9Using_Linux_Tools_1b0', 'ch9Using_Linux_Tools_1b1', 'ch9Using_Linux_Tools_1b2', 'ch9Using_Linux_Tools_1b3', 'ch9Using_Linux_Tools_1b4', 'ch9Using_Linux_Tools_1b5', 'ch9Using_Linux_Tools_1b6', 'ch9Using_Linux_Tools_1b7', 'ch9Using_Linux_Tools_1b8', 'ch9Using_Linux_Tools_1b9', 'ch9Using_Linux_Tools_1ba', 'ch9Using_Linux_Tools_1bb', 'ch9Using_Linux_Tools_1bc', 'ch9Using_Linux_Tools_1bd', 'ch9Using_Linux_Tools_1be', 'ch9Using_Linux_Tools_1bf', 'ch9Using_Linux_Tools_1c0', 'ch9Using_Linux_Tools_1c1', 'ch9Using_Linux_Tools_1c2', 'ch9Using_Linux_Tools_1c3', 'ch9Using_Linux_Tools_1c4', 'ch9Using_Linux_Tools_1c5', 'ch9Using_Linux_Tools_1c6', 'ch9Using_Linux_Tools_1c7', 'ch9Using_Linux_Tools_1c8', 'ch9Using_Linux_Tools_1c9', 'ch9Using_Linux_Tools_1ca', 'ch9Using_Linux_Tools_1cb', 'ch9Using_Linux_Tools_1cc', 'ch9Using_Linux_Tools_1cd', 'ch9Using_Linux_Tools_1ce', 'ch9Using_Linux_Tools_1cf', 'ch9Using_Linux_Tools_1d0', 'ch9Using_Linux_Tools_1d1', 'ch9Using_Linux_Tools_1d2', 'ch9Using_Linux_Tools_1d3', 'ch9Using_Linux_Tools_1d4', 'ch9Using_Linux_Tools_1d5', 'ch9Using_Linux_Tools_1d6', 'ch9Using_Linux_Tools_1d7', 'ch9Using_Linux_Tools_1d8', 'ch9Using_Linux_Tools_1d9', 'ch9Using_Linux_Tools_1da', 'ch9Using_Linux_Tools_1db', 'ch9Using_Linux_Tools_1dc', 'ch9Using_Linux_Tools_1dd', 'ch9Using_Linux_Tools_1de', 'ch9Using_Linux_Tools_1df', 'ch9Using_Linux_Tools_1e0', 'ch9Using_Linux_Tools_1e1'], 'ch1Introduction': ['ch1Introduction_1', 'ch1Introduction_2', 'ch1Introduction_3', 'ch1Introduction_4', 'ch1Introduction_5', 'ch1Introduction_6', 'ch1Introduction_7', 'ch1Introduction_8', 'ch1Introduction_9', 'ch1Introduction_a', 'ch1Introduction_b', 'ch1Introduction_c', 'ch1Introduction_d'], 'ch5func': ['ch5func_1', 'ch5func_2', 'ch5func_3', 'ch5func_4', 'ch5func_5', 'ch5func_6', 'ch5func_7', 'ch5func_8', 'ch5func_9', 'ch5func_a', 'ch5func_b', 'ch5func_c', 'ch5func_d', 'ch5func_e', 'ch5func_f', 'ch5func_10', 'ch5func_11', 'ch5func_12', 'ch5func_13', 'ch5func_14', 'ch5func_15', 'ch5func_16', 'ch5func_17', 'ch5func_18', 'ch5func_19', 'ch5func_1a', 'ch5func_1b', 'ch5func_1c', 'ch5func_1d', 'ch5func_1e', 'ch5func_1f'], 'ch3list_tuples': ['ch3list_tuples_1', 'ch3list_tuples_2', 'ch3list_tuples_3', 'ch3list_tuples_4', 'ch3list_tuples_5', 'ch3list_tuples_6', 'ch3list_tuples_7', 'ch3list_tuples_8', 'ch3list_tuples_9', 'ch3list_tuples_a', 'ch3list_tuples_b', 'ch3list_tuples_c', 'ch3list_tuples_d', 'ch3list_tuples_e', 'ch3list_tuples_f', 'ch3list_tuples_10', 'ch3list_tuples_11', 'ch3list_tuples_12', 'ch3list_tuples_13', 'ch3list_tuples_14', 'ch3list_tuples_15', 'ch3list_tuples_16', 'ch3list_tuples_17', 'ch3list_tuples_18', 'ch3list_tuples_19', 'ch3list_tuples_1a', 'ch3list_tuples_1b', 'ch3list_tuples_1c', 'ch3list_tuples_1d', 'ch3list_tuples_1e', 'ch3list_tuples_1f', 'ch3list_tuples_20', 'ch3list_tuples_21', 'ch3list_tuples_22', 'ch3list_tuples_23', 'ch3list_tuples_24', 'ch3list_tuples_25', 'ch3list_tuples_26', 'ch3list_tuples_27', 'ch3list_tuples_28', 'ch3list_tuples_29', 'ch3list_tuples_2a', 'ch3list_tuples_2b', 'ch3list_tuples_2c', 'ch3list_tuples_2d', 'ch3list_tuples_2e', 'ch3list_tuples_2f', 'ch3list_tuples_30', 'ch3list_tuples_31', 'ch3list_tuples_32', 'ch3list_tuples_33', 'ch3list_tuples_34', 'ch3list_tuples_35', 'ch3list_tuples_36', 'ch3list_tuples_37'], 'ch2intro': ['ch2intro_1', 'ch2intro_2', 'ch2intro_3', 'ch2intro_4', 'ch2intro_5', 'ch2intro_6', 'ch2intro_7', 'ch2intro_8', 'ch2intro_9', 'ch2intro_a', 'ch2intro_b', 'ch2intro_c', 'ch2intro_d', 'ch2intro_e', 'ch2intro_f', 'ch2intro_10', 'ch2intro_11', 'ch2intro_12', 'ch2intro_13', 'ch2intro_14', 'ch2intro_15', 'ch2intro_16', 'ch2intro_17', 'ch2intro_18', 'ch2intro_19', 'ch2intro_1a', 'ch2intro_1b', 'ch2intro_1c', 'ch2intro_1d', 'ch2intro_1e', 'ch2intro_1f', 'ch2intro_20', 'ch2intro_21', 'ch2intro_22', 'ch2intro_23', 'ch2intro_24', 'ch2intro_25', 'ch2intro_26', 'ch2intro_27', 'ch2intro_28', 'ch2intro_29', 'ch2intro_2a', 'ch2intro_2b', 'ch2intro_2c', 'ch2intro_2d', 'ch2intro_2e', 'ch2intro_2f', 'ch2intro_30', 'ch2intro_31', 'ch2intro_32', 'ch2intro_33', 'ch2intro_34', 'ch2intro_35', 'ch2intro_36', 'ch2intro_37', 'ch2intro_38', 'ch2intro_39', 'ch2intro_3a', 'ch2intro_3b', 'ch2intro_3c', 'ch2intro_3d', 'ch2intro_3e', 'ch2intro_3f', 'ch2intro_40', 'ch2intro_41', 'ch2intro_42', 'ch2intro_43', 'ch2intro_44', 'ch2intro_45', 'ch2intro_46', 'ch2intro_47', 'ch2intro_48', 'ch2intro_49', 'ch2intro_4a', 'ch2intro_4b', 'ch2intro_4c', 'ch2intro_4d', 'ch2intro_4e', 'ch2intro_4f', 'ch2intro_50', 'ch2intro_51', 'ch2intro_52', 'ch2intro_53', 'ch2intro_54', 'ch2intro_55', 'ch2intro_56', 'ch2intro_57', 'ch2intro_58', 'ch2intro_59', 'ch2intro_5a', 'ch2intro_5b', 'ch2intro_5c', 'ch2intro_5d', 'ch2intro_5e', 'ch2intro_5f', 'ch2intro_60', 'ch2intro_61', 'ch2intro_62', 'ch2intro_63', 'ch2intro_64', 'ch2intro_65', 'ch2intro_66', 'ch2intro_67'], 'ch4strings_dicts': ['ch4strings_dicts_1', 'ch4strings_dicts_2', 'ch4strings_dicts_3', 'ch4strings_dicts_4', 'ch4strings_dicts_5', 'ch4strings_dicts_6', 'ch4strings_dicts_7', 'ch4strings_dicts_8', 'ch4strings_dicts_9', 'ch4strings_dicts_a', 'ch4strings_dicts_b', 'ch4strings_dicts_c', 'ch4strings_dicts_d', 'ch4strings_dicts_e', 'ch4strings_dicts_f', 'ch4strings_dicts_10', 'ch4strings_dicts_11', 'ch4strings_dicts_12', 'ch4strings_dicts_13', 'ch4strings_dicts_14', 'ch4strings_dicts_15', 'ch4strings_dicts_16', 'ch4strings_dicts_17', 'ch4strings_dicts_18', 'ch4strings_dicts_19', 'ch4strings_dicts_1a', 'ch4strings_dicts_1b', 'ch4strings_dicts_1c', 'ch4strings_dicts_1d', 'ch4strings_dicts_1e', 'ch4strings_dicts_1f', 'ch4strings_dicts_20', 'ch4strings_dicts_21', 'ch4strings_dicts_22', 'ch4strings_dicts_23', 'ch4strings_dicts_24', 'ch4strings_dicts_25', 'ch4strings_dicts_26', 'ch4strings_dicts_27', 'ch4strings_dicts_28', 'ch4strings_dicts_29', 'ch4strings_dicts_2a', 'ch4strings_dicts_2b', 'ch4strings_dicts_2c', 'ch4strings_dicts_2d', 'ch4strings_dicts_2e', 'ch4strings_dicts_2f', 'ch4strings_dicts_30'], 'ch11Section_5': ['ch11Section_5_1', 'ch11Section_5_2', 'ch11Section_5_3', 'ch11Section_5_4', 'ch11Section_5_5', 'ch11Section_5_6', 'ch11Section_5_7', 'ch11Section_5_8', 'ch11Section_5_9', 'ch11Section_5_a', 'ch11Section_5_b', 'ch11Section_5_c', 'ch11Section_5_d', 'ch11Section_5_e', 'ch11Section_5_f', 'ch11Section_5_10', 'ch11Section_5_11', 'ch11Section_5_12', 'ch11Section_5_13', 'ch11Section_5_14', 'ch11Section_5_15', 'ch11Section_5_16', 'ch11Section_5_17', 'ch11Section_5_18', 'ch11Section_5_19', 'ch11Section_5_1a', 'ch11Section_5_1b', 'ch11Section_5_1c', 'ch11Section_5_1d', 'ch11Section_5_1e', 'ch11Section_5_1f', 'ch11Section_5_20', 'ch11Section_5_21', 'ch11Section_5_22', 'ch11Section_5_23', 'ch11Section_5_24', 'ch11Section_5_25', 'ch11Section_5_26', 'ch11Section_5_27', 'ch11Section_5_28', 'ch11Section_5_29', 'ch11Section_5_2a', 'ch11Section_5_2b', 'ch11Section_5_2c', 'ch11Section_5_2d', 'ch11Section_5_2e', 'ch11Section_5_2f', 'ch11Section_5_30', 'ch11Section_5_31', 'ch11Section_5_32', 'ch11Section_5_33', 'ch11Section_5_34', 'ch11Section_5_35', 'ch11Section_5_36', 'ch11Section_5_37', 'ch11Section_5_38', 'ch11Section_5_39', 'ch11Section_5_3a', 'ch11Section_5_3b', 'ch11Section_5_3c', 'ch11Section_5_3d', 'ch11Section_5_3e', 'ch11Section_5_3f', 'ch11Section_5_40', 'ch11Section_5_41', 'ch11Section_5_42', 'ch11Section_5_43', 'ch11Section_5_44', 'ch11Section_5_45', 'ch11Section_5_46', 'ch11Section_5_47', 'ch11Section_5_48', 'ch11Section_5_49', 'ch11Section_5_4a', 'ch11Section_5_4b', 'ch11Section_5_4c', 'ch11Section_5_4d', 'ch11Section_5_4e', 'ch11Section_5_4f', 'ch11Section_5_50', 'ch11Section_5_51', 'ch11Section_5_52', 'ch11Section_5_53', 'ch11Section_5_54', 'ch11Section_5_55', 'ch11Section_5_56', 'ch11Section_5_57', 'ch11Section_5_58', 'ch11Section_5_59', 'ch11Section_5_5a', 'ch11Section_5_5b', 'ch11Section_5_5c', 'ch11Section_5_5d', 'ch11Section_5_5e', 'ch11Section_5_5f', 'ch11Section_5_60', 'ch11Section_5_61', 'ch11Section_5_62', 'ch11Section_5_63', 'ch11Section_5_64', 'ch11Section_5_65', 'ch11Section_5_66', 'ch11Section_5_67', 'ch11Section_5_68', 'ch11Section_5_69', 'ch11Section_5_6a', 'ch11Section_5_6b', 'ch11Section_5_6c', 'ch11Section_5_6d', 'ch11Section_5_6e'], 'ch7interim_assessment': [], 'ch8ult_module_plan': ['ch8ult_module_plan_1', 'ch8ult_module_plan_2', 'ch8ult_module_plan_3', 'ch8ult_module_plan_4', 'ch8ult_module_plan_5', 'ch8ult_module_plan_6', 'ch8ult_module_plan_7', 'ch8ult_module_plan_8', 'ch8ult_module_plan_9', 'ch8ult_module_plan_a', 'ch8ult_module_plan_b', 'ch8ult_module_plan_c', 'ch8ult_module_plan_d', 'ch8ult_module_plan_e', 'ch8ult_module_plan_f', 'ch8ult_module_plan_10', 'ch8ult_module_plan_11', 'ch8ult_module_plan_12', 'ch8ult_module_plan_13', 'ch8ult_module_plan_14', 'ch8ult_module_plan_15', 'ch8ult_module_plan_16', 'ch8ult_module_plan_17', 'ch8ult_module_plan_18', 'ch8ult_module_plan_19', 'ch8ult_module_plan_1a', 'ch8ult_module_plan_1b', 'ch8ult_module_plan_1c', 'ch8ult_module_plan_1d', 'ch8ult_module_plan_1e', 'ch8ult_module_plan_1f', 'ch8ult_module_plan_20', 'ch8ult_module_plan_21', 'ch8ult_module_plan_22', 'ch8ult_module_plan_23', 'ch8ult_module_plan_24', 'ch8ult_module_plan_25', 'ch8ult_module_plan_26', 'ch8ult_module_plan_27', 'ch8ult_module_plan_28', 'ch8ult_module_plan_29', 'ch8ult_module_plan_2a', 'ch8ult_module_plan_2b', 'ch8ult_module_plan_2c', 'ch8ult_module_plan_2d', 'ch8ult_module_plan_2e', 'ch8ult_module_plan_2f', 'ch8ult_module_plan_30', 'ch8ult_module_plan_31', 'ch8ult_module_plan_32', 'ch8ult_module_plan_33', 'ch8ult_module_plan_34', 'ch8ult_module_plan_35', 'ch8ult_module_plan_36', 'ch8ult_module_plan_37', 'ch8ult_module_plan_38', 'ch8ult_module_plan_39', 'ch8ult_module_plan_3a', 'ch8ult_module_plan_3b', 'ch8ult_module_plan_3c', 'ch8ult_module_plan_3d', 'ch8ult_module_plan_3e', 'ch8ult_module_plan_3f', 'ch8ult_module_plan_40', 'ch8ult_module_plan_41', 'ch8ult_module_plan_42', 'ch8ult_module_plan_43', 'ch8ult_module_plan_44', 'ch8ult_module_plan_45', 'ch8ult_module_plan_46', 'ch8ult_module_plan_47', 'ch8ult_module_plan_48', 'ch8ult_module_plan_49', 'ch8ult_module_plan_4a', 'ch8ult_module_plan_4b', 'ch8ult_module_plan_4c', 'ch8ult_module_plan_4d'], 'ch10session4': ['ch10session4_1', 'ch10session4_2', 'ch10session4_3', 'ch10session4_4', 'ch10session4_5', 'ch10session4_6', 'ch10session4_7', 'ch10session4_8', 'ch10session4_9', 'ch10session4_a', 'ch10session4_b', 'ch10session4_c', 'ch10session4_d', 'ch10session4_e', 'ch10session4_f', 'ch10session4_10', 'ch10session4_11', 'ch10session4_12', 'ch10session4_13', 'ch10session4_14', 'ch10session4_15', 'ch10session4_16', 'ch10session4_17', 'ch10session4_18', 'ch10session4_19', 'ch10session4_1a', 'ch10session4_1b', 'ch10session4_1c', 'ch10session4_1d', 'ch10session4_1e', 'ch10session4_1f', 'ch10session4_20', 'ch10session4_21', 'ch10session4_22', 'ch10session4_23', 'ch10session4_24', 'ch10session4_25', 'ch10session4_26', 'ch10session4_27', 'ch10session4_28', 'ch10session4_29', 'ch10session4_2a', 'ch10session4_2b', 'ch10session4_2c', 'ch10session4_2d', 'ch10session4_2e', 'ch10session4_2f', 'ch10session4_30', 'ch10session4_31', 'ch10session4_32', 'ch10session4_33', 'ch10session4_34', 'ch10session4_35', 'ch10session4_36', 'ch10session4_37', 'ch10session4_38', 'ch10session4_39', 'ch10session4_3a', 'ch10session4_3b', 'ch10session4_3c', 'ch10session4_3d', 'ch10session4_3e', 'ch10session4_3f', 'ch10session4_40', 'ch10session4_41', 'ch10session4_42', 'ch10session4_43', 'ch10session4_44', 'ch10session4_45', 'ch10session4_46', 'ch10session4_47', 'ch10session4_48', 'ch10session4_49', 'ch10session4_4a', 'ch10session4_4b', 'ch10session4_4c', 'ch10session4_4d', 'ch10session4_4e', 'ch10session4_4f', 'ch10session4_50', 'ch10session4_51', 'ch10session4_52', 'ch10session4_53', 'ch10session4_54', 'ch10session4_55', 'ch10session4_56', 'ch10session4_57', 'ch10session4_58', 'ch10session4_59', 'ch10session4_5a', 'ch10session4_5b', 'ch10session4_5c', 'ch10session4_5d', 'ch10session4_5e', 'ch10session4_5f', 'ch10session4_60', 'ch10session4_61', 'ch10session4_62', 'ch10session4_63', 'ch10session4_64', 'ch10session4_65', 'ch10session4_66', 'ch10session4_67', 'ch10session4_68', 'ch10session4_69', 'ch10session4_6a', 'ch10session4_6b', 'ch10session4_6c', 'ch10session4_6d', 'ch10session4_6e', 'ch10session4_6f', 'ch10session4_70', 'ch10session4_71', 'ch10session4_72', 'ch10session4_73', 'ch10session4_74', 'ch10session4_75', 'ch10session4_76', 'ch10session4_77', 'ch10session4_78', 'ch10session4_79', 'ch10session4_7a', 'ch10session4_7b', 'ch10session4_7c', 'ch10session4_7d', 'ch10session4_7e', 'ch10session4_7f', 'ch10session4_80', 'ch10session4_81', 'ch10session4_82']}
\ No newline at end of file
--- a/SEESenv/web/html/ch1Introduction.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. Introduction</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch1Introduction">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl><dt><span class="article"><a href="#id2496482">Introduction to the Course</a></span></dt></dl>
-</div>
-<div class="article" title="Introduction to the Course">
-<div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2496482"></a>Introduction to the Course</h2></div></div>
-<hr />
-</div>
-<p id="ch1Introduction_1">Engineering students use computers for a large number of curricular
-tasks  mostly computation centred. However, they do not see this as coding or programming tasks and usually are not even aware of the tools and
-techniques that will help them to handle these tasks better. This results
-in less than optimal use of their time and resources. This also causes
-difficulties when it comes tocollaboration and building on other peoples
-work. This course is intended to train such students in good software
-practices and tools for producing code and documentation.</p>
-<p id="ch1Introduction_2">After successfully completing the program, the participants will be able to:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_3">understand how software tools work together and how they can be used in tandem to carry out tasks,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_4">use unix command line tools to carry out common (mostly text processing tasks,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_5">to generate professional documents,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_6">use version control effectively  for both code and documents,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_7">automate tasks by writing shell scripts and python scripts,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_8">realise the impact of coding style and readbility on quality,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_9">write mid-sized programs that carry out typical engineering / numerical computations such as those that involve (basic) manipulation of large arrays in an efficient manner,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_a">generate 2D and simple 3D plots,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_b">debug programs using a standardised approach,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_c">understand the importance of tests and the philosophy of Test Driven Development,</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch1Introduction_d">write unit tests and improve the quality of code.</p></li>
-</ul></div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch2intro.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,663 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. intro</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch2intro">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2915639">Basic Python</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2723402">1. Introduction</a></span></dt>
-<dt><span class="section"><a href="#id2966769">2. The Python Interpreter</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2966777">2.1. The Interactive Interpreter</a></span></dt>
-<dt><span class="section"><a href="#id2966950">2.2. <span class="emphasis"><em>ipython</em></span> - An enhanced interactive Python interpreter</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967075">3. Editing and running a python file</a></span></dt>
-<dt><span class="section"><a href="#id2967182">4. Basic Datatypes and operators in Python</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2967216">4.1. Numbers</a></span></dt>
-<dt><span class="section"><a href="#id2967346">4.2. Variables</a></span></dt>
-<dt><span class="section"><a href="#id2967394">4.3. Strings</a></span></dt>
-<dt><span class="section"><a href="#id2967588">4.4. Boolean</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967617">5. The <span class="strong"><strong>while</strong></span> loop</a></span></dt>
-<dt><span class="section"><a href="#id2967654">6. The <span class="strong"><strong>if</strong></span> conditional</a></span></dt>
-<dt><span class="section"><a href="#id2967723">7. <span class="strong"><strong>raw_input()</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id2967877">8. <span class="strong"><strong>int()</strong></span> method</a></span></dt>
-</dl></dd>
-</dl>
-</div>
-<div class="article" title="Basic Python">
-<div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2915639"></a>Basic Python</h2></div></div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2723402">1. Introduction</a></span></dt>
-<dt><span class="section"><a href="#id2966769">2. The Python Interpreter</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2966777">2.1. The Interactive Interpreter</a></span></dt>
-<dt><span class="section"><a href="#id2966950">2.2. <span class="emphasis"><em>ipython</em></span> - An enhanced interactive Python interpreter</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967075">3. Editing and running a python file</a></span></dt>
-<dt><span class="section"><a href="#id2967182">4. Basic Datatypes and operators in Python</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2967216">4.1. Numbers</a></span></dt>
-<dt><span class="section"><a href="#id2967346">4.2. Variables</a></span></dt>
-<dt><span class="section"><a href="#id2967394">4.3. Strings</a></span></dt>
-<dt><span class="section"><a href="#id2967588">4.4. Boolean</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967617">5. The <span class="strong"><strong>while</strong></span> loop</a></span></dt>
-<dt><span class="section"><a href="#id2967654">6. The <span class="strong"><strong>if</strong></span> conditional</a></span></dt>
-<dt><span class="section"><a href="#id2967723">7. <span class="strong"><strong>raw_input()</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id2967877">8. <span class="strong"><strong>int()</strong></span> method</a></span></dt>
-</dl>
-</div>
-<p id="ch2intro_1">This document is intended to be handed out at the end of the workshop. It has
-been designed for Engineering students who are Python beginners and have basic
-programming skills. The focus is on basic numerics and plotting using Python.</p>The system requirements:<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_2">Python - version 2.5.x or newer.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_3">IPython</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_4">Text editor - scite, vim, emacs or whatever you are comfortable with.</p></li>
-</ul></div>
-<div class="section" title="1.Introduction">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2723402"></a>1.Introduction</h2></div></div></div>
-<p id="ch2intro_5">The Python programming language was created by a dutch named Guido van Rossum.
-The idea of Python was conceived in December 1989. The name Python has nothing
-to do with the reptilian, but its been named after the 70s comedy series
-"Monty Python's Flying Circus", since it happens to be Guido's favourite
-TV series.</p>
-<p id="ch2intro_6">Current stable version of Python is 2.6.x, although Python 3.0 is also the stable
-version, it is not backwards compatible with the previous versions and is hence
-not entirely popular at the moment. This material will focus on the 2.6.x series.</p>
-<p id="ch2intro_7">Python is licensed under the Python Software Foundation License (PSF License)
-which is GPL compatible Free Software license (excepting license version 1.6 and 2.0)
-It is a no strings attached license, which means the source code is free to modify
-and redistribute.</p>
-<p id="ch2intro_8">The Python docs define Python as "Python is an interpreted, object-oriented,
-high-level programming language with dynamic semantics." A more detailed summary
-can be found at </p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.python.org/doc/essays/blurb.html</div>
-<p>. Python is a language that
-has been designed to help the programmer concentrate on solving the problem at hand
-and not worry about the programming language idiosyncrasies.</p>
-<p id="ch2intro_9">Python is a highly cross platform compatible language on account of it being an
-interpreted language. It is highly scalable and hence has been adapted to run on
-the Nokia 60 series phones. Python has been designed to be readable and easy to use</p>
-<p id="ch2intro_a"><span class="strong"><strong>Resources available for reference</strong></span></p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *">
-<p id="ch2intro_b">Web: </p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.python.org</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch2intro_c">Doc: </p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.python.org/doc</div>
-</li>
-<li class="listitem" style="list-style-type: *">Free Tutorials:<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *">
-<p id="ch2intro_d">Official Python Tutorial: </p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://docs.python.org/tut/tut.html</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch2intro_e">Byte of Python: </p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.byteofpython.info/</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch2intro_f">Dive into Python: </p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://diveintopython.org/</div>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<p id="ch2intro_10"><span class="strong"><strong>Advantages of Python - Why Python??</strong></span></p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_11">Python has been designed for readability and ease of use. Its been designed in
-such a fashion that it imposes readability on the programmer. Python does away
-with the braces and the semicolons and instead implements code blocks based on
-indentation, thus enhancing readability.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_12">Python is a high level, interpreted, modular and object oriented language.
-Python performs memory management on its own, thus the programmer need not bother
-about allocating and deallocating memory to variables. Python provides extensibility
-by providing modules which can be easily imported similar to headers in C and
-packages in Java. Python is object oriented and hence provides all the object oriented
-characteristics such as inheritance, encapsulation and polymorphism.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_13">Python offers a highly powerful interactive programming interface in the form
-of the 'Interactive Interpreter' which will be discussed in more detail in the
-following sections.</p></li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch2intro_14">Python provides a rich standard library and an extensive set of modules. The
-power of Python modules can be seen in this slightly exaggerated cartoon
-</p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://xkcd.com/353/</div>
-</li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_15">Python interfaces well with most other programming languages such as C, C++
-and FORTRAN.</p></li>
-</ul></div>
-<p id="ch2intro_16">Although, Python has one setback. Python is not fast as some of the compiled
-languages like C or C++. Yet, the amount of flexibility and power more than make
-up for this setback.</p>
-</div>
-<div class="section" title="2.The Python Interpreter">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2966769"></a>2.The Python Interpreter</h2></div></div></div>
-<div class="section" title="2.1.The Interactive Interpreter">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2966777"></a>2.1.The Interactive Interpreter</h3></div></div></div>
-<p id="ch2intro_17">Typing <span class="emphasis"><em>python</em></span> at the shell prompt on any standard Unix/Gnu-Linux system and
-hitting the enter key fires up the Python 'Interactive Interpreter'. The Python
-interpreter is one of the most integral features of Python. The prompt obtained
-when the interactive interpreter is similar to what is shown below. The exact
-appearance might differ based on the version of Python being used. The <code class="literal">&gt;&gt;&gt;</code>
-thing shown is the python prompt. When something is typed at the prompt and the
-enter key is hit, the python interpreter interprets the command entered and
-performs the appropriate action. All the examples presented in this document are
-to be tried hands on, on the interactive interpreter.</p>
-<pre class="programlisting">
-Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
-[GCC 4.3.2] on linux2
-Type "help", "copyright", "credits" or "license" for more information.
-&gt;&gt;&gt;</pre>
-<p id="ch2intro_18">Lets try with an example, type <code class="literal">print 'Hello, World!'</code> at the prompt and hit
-the enter key.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; print 'Hello, World!'
-Hello, World!</pre>
-<p id="ch2intro_19">This example was quite straight forward, and thus we have written our first
-line of Python code. Now let us try typing something arbitrary at the prompt.
-For example:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; arbit word
-  File "&lt;stdin&gt;", line 1
-    arbit word
-            ^
-SyntaxError: invalid syntax
-&gt;&gt;&gt;</pre>
-<p id="ch2intro_1a">The interpreter gave an error message saying that 'arbit word' was invalid
-syntax which is valid. The interpreter is an amazing tool when learning to
-program in Python. The interpreter provides a help function that provides the
-necessary documentation regarding all Python syntax, constructs, modules and
-objects. Typing <span class="emphasis"><em>help()</em></span> at the prompt gives the following output:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; help()
-
-Welcome to Python 2.5!  This is the online help utility.
-
-If this is your first time using Python, you should definitely check out
-the tutorial on the Internet at http://www.python.org/doc/tut/.
-
-Enter the name of any module, keyword, or topic to get help on writing
-Python programs and using Python modules.  To quit this help utility and
-return to the interpreter, just type "quit".
-
-To get a list of available modules, keywords, or topics, type "modules",
-"keywords", or "topics".  Each module also comes with a one-line summary
-of what it does; to list the modules whose summaries contain a given word
-such as "spam", type "modules spam".
-
-help&gt;</pre>
-<p id="ch2intro_1b">As mentioned in the output, entering the name of any module, keyword or topic
-will provide the documentation and help regarding the same through the online
-help utility. Pressing <span class="emphasis"><em>Ctrl+d</em></span> exits the help prompt and returns to the
-python prompt.</p>
-<p id="ch2intro_1c">Let us now try a few examples at the python interpreter.</p>
-<p id="ch2intro_1d">Eg 1:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; print 'Hello, python!'
-Hello, python!
-&gt;&gt;&gt;</pre>
-<p id="ch2intro_1e">Eg 2:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; print 4321*567890
-2453852690
-&gt;&gt;&gt;</pre>
-<p id="ch2intro_1f">Eg 3:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; 4321*567890
-2453852690L
-&gt;&gt;&gt;</pre>
-<pre class="programlisting">
-Note: Notice the 'L' at the end of the output. The 'L' signifies that the
-output of the operation is of type *long*. It was absent in the previous
-example because we used the print statement. This is because *print* formats
-the output before displaying.</pre>
-<p id="ch2intro_20">Eg 4:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; big = 12345678901234567890 ** 3
-&gt;&gt;&gt; print big
-1881676372353657772490265749424677022198701224860897069000
-&gt;&gt;&gt;</pre>
-<pre class="programlisting">
-This example is to show that unlike in C or C++ there is no limit on the
-value of an integer.</pre>
-<p id="ch2intro_21">Try this on the interactive interpreter:
-<code class="literal">import this</code></p>
-<p id="ch2intro_22"><span class="emphasis"><em>Hint: The output gives an idea of Power of Python</em></span></p>
-</div>
-<div class="section" title="2.2.ipython - An enhanced interactive Python interpreter">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2966950"></a>2.2.<span class="emphasis"><em>ipython</em></span> - An enhanced interactive Python interpreter</h3></div></div></div>
-<p id="ch2intro_23">The power and the importance of the interactive interpreter was the highlight
-of the previous section. This section provides insight into the enhanced
-interpreter with more advanced set of features called <span class="strong"><strong>ipython</strong></span>. Entering
-<span class="emphasis"><em>ipython</em></span> at the shell prompt fires up the interactive interpreter.</p>
-<pre class="programlisting">
-$ ipython
-Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
-Type "copyright", "credits" or "license" for more information.
-
-IPython 0.8.4 -- An enhanced Interactive Python.
-?         -&gt; Introduction and overview of IPython's features.
-%quickref -&gt; Quick reference.
-help      -&gt; Python's own help system.
-object?   -&gt; Details about 'object'. ?object also works, ?? prints more.
-
-In [1]:</pre>
-<p id="ch2intro_24">This is the output obtained upon firing ipython. The exact appearance may
-change based on the Python version installed. The following are some of the
-various features provided by <span class="strong"><strong>ipython</strong></span>:</p>
-<p id="ch2intro_25">Suggestions - ipython provides suggestions of the possible methods and
-operations available for the given python object.</p>
-<p id="ch2intro_26">Eg 5:</p>
-<pre class="programlisting">
-In [4]: a = 6
-
-In [5]: a.
-a.__abs__           a.__divmod__        a.__index__         a.__neg__          a.__rand__          a.__rmod__          a.__rxor__
-a.__add__           a.__doc__           a.__init__          a.__new__          a.__rdiv__          a.__rmul__          a.__setattr__
-a.__and__           a.__float__         a.__int__           a.__nonzero__      a.__rdivmod__       a.__ror__           a.__str__
-a.__class__         a.__floordiv__      a.__invert__        a.__oct__          a.__reduce__        a.__rpow__          a.__sub__
-a.__cmp__           a.__getattribute__  a.__long__          a.__or__           a.__reduce_ex__     a.__rrshift__       a.__truediv__
-a.__coerce__        a.__getnewargs__    a.__lshift__        a.__pos__          a.__repr__          a.__rshift__        a.__xor__
-a.__delattr__       a.__hash__          a.__mod__           a.__pow__          a.__rfloordiv__     a.__rsub__
-a.__div__           a.__hex__           a.__mul__           a.__radd__         a.__rlshift__       a.__rtruediv__</pre>
-<p id="ch2intro_27">In this example, we initialized 'a' (a variable - a concept that will be
-discussed in the subsequent sections.) to 6. In the next line when the <span class="emphasis"><em>tab</em></span> key
-is pressed after typing '<span class="emphasis"><em>a.</em></span>' ipython displays the set of all possible methods
-that are applicable on the object 'a' (an integer in this context). Ipython
-provides many such datatype specific features which will be presented in the
-further sections as and when the datatypes are introduced.</p>
-</div>
-</div>
-<div class="section" title="3.Editing and running a python file">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967075"></a>3.Editing and running a python file</h2></div></div></div>
-<p id="ch2intro_28">The previous sections focused on the use of the interpreter to run python code.
-While the interpeter is an excellent tool to test simple solutions and
-experiment with small code snippets, its main disadvantage is that everything
-written in the interpreter is lost once its quit. Most of the times a program is
-used by people other than the author. So the programs have to be available in
-some form suitable for distribution, and hence they are written in files. This
-section will focus on editing and running python files. Start by opening a text
-editor ( it is recommended you choose one from the list at the top of this page ).
-In the editor type down python code and save the file with an extension <span class="strong"><strong>.py</strong></span>
-(python files have an extension of .py). Once done with the editing, save the
-file and exit the editor.</p>
-<p id="ch2intro_29">Let us look at a simple example of calculating the gcd of 2 numbers using Python:</p>
-<p id="ch2intro_2a"><span class="strong"><strong>Creating the first python script(file)</strong></span></p>
-<pre class="programlisting">
-$ emacs gcd.py
-  def gcd(x,y):
-    if x % y == 0:
-      return y
-    return gcd(y, x%y)
-
-  print gcd(72, 92)</pre>
-<p id="ch2intro_2b">To run the script, open the shell prompt, navigate to the directory that
-contains the python file and run <code class="literal">python &lt;filename.py&gt;</code> at the prompt ( in this
-case filename is gcd.py )</p>
-<p id="ch2intro_2c"><span class="strong"><strong>Running the python script</strong></span></p>
-<pre class="programlisting">
-$ python gcd.py
-4
-$</pre>
-<p id="ch2intro_2d">Another method to run a python script would be to include the line</p>
-<p id="ch2intro_2e"><code class="literal">#! /usr/bin/python</code></p>
-<p id="ch2intro_2f">at the beginning of the python file and then make the file executable by</p>
-<p id="ch2intro_30">$ chmod a+x <span class="emphasis"><em>filename.py</em></span></p>
-<p id="ch2intro_31">Once this is done, the script can be run as a standalone program as follows:</p>
-<p id="ch2intro_32">$ ./<span class="emphasis"><em>filename.py</em></span></p>
-</div>
-<div class="section" title="4.Basic Datatypes and operators in Python">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967182"></a>4.Basic Datatypes and operators in Python</h2></div></div></div>
-<p id="ch2intro_33">Python provides the following set of basic datatypes.</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_34">Numbers: int, float, long, complex</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_35">Strings</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_36">Boolean</p></li>
-</ul></div>
-<div class="section" title="4.1.Numbers">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967216"></a>4.1.Numbers</h3></div></div></div>
-<p id="ch2intro_37">Numbers were introduced in the examples presented in the interactive interpreter
-section. Numbers include types as mentioned earlier viz., int (integers), float
-(floating point numbers), long (large integers), complex (complex numbers with
-real and imaginary parts). Python is not a strongly typed language, which means
-the type of a variable need not mentioned during its initialization. Let us look
-at a few examples.</p>
-<p id="ch2intro_38">Eg 6:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = 1 #here a is an integer variable</pre>
-<p id="ch2intro_39">Eg 7:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; lng = 122333444455555666666777777788888888999999999 #here lng is a variable of type long
-&gt;&gt;&gt; lng
-122333444455555666666777777788888888999999999L #notice the trailing 'L'
-&gt;&gt;&gt; print lng
-122333444455555666666777777788888888999999999 #notice the absence of the trailing 'L'
-&gt;&gt;&gt; lng+1
-122333444455555666666777777788888889000000000L</pre>
-<p id="ch2intro_3a">Long numbers are the same as integers in almost all aspects. They can be used in
-operations just like integers and along with integers without any distinction.
-The only distinction comes during type checking (which is not a healthy practice).
-Long numbers are tucked with a trailing 'L' just to signify that they are long.
-Notice that in the example just lng at the prompt displays the value of the variable
-with the 'L' whereas <code class="literal">print lng</code> displays without the 'L'. This is because print
-formats the output before printing. Also in the example, notice that adding an
-integer to a long does not give any errors and the result is as expected. So for
-all practical purposes longs can be treated as ints.</p>
-<p id="ch2intro_3b">Eg 8:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; fl = 3.14159 #fl is a float variable
-&gt;&gt;&gt; e = 1.234e-4 #e is also a float variable, specified in the exponential form
-&gt;&gt;&gt; a = 1
-&gt;&gt;&gt; b = 2
-&gt;&gt;&gt; a/b #integer division
-0
-&gt;&gt;&gt; a/fl #floating point division
-0.31831015504887655
-&gt;&gt;&gt; e/fl
-3.9279473133031364e-05</pre>
-<p id="ch2intro_3c">Floating point numbers, simply called floats are real numbers with a decimal point.
-The example above shows the initialization of a float variable. Shown also in this
-example is the difference between integer division and floating point division.
-'a' and 'b' here are integer variables and hence the division gives 0 as the quotient.
-When either of the operands is a float, the operation is a floating point division,
-and the result is also a float as illustrated.</p>
-<p id="ch2intro_3d">Eg 9:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; cplx = 3 + 4j #cplx is a complex variable
-&gt;&gt;&gt; cplx
-(3+4j)
-&gt;&gt;&gt; print cplx.real #prints the real part of the complex number
-3.0
-&gt;&gt;&gt; print cplx.imag #prints the imaginary part of the complex number
-4.0
-&gt;&gt;&gt; print cplx*fl  #multiplies the real and imag parts of the complex number with the multiplier
-(9.42477+12.56636j)
-&gt;&gt;&gt; abs(cplx) #returns the absolute value of the complex number
-5.0</pre>
-<p id="ch2intro_3e">Python provides a datatype for complex numbers. Complex numbers are initialized
-as shown in the example above. The <span class="emphasis"><em>real</em></span> and <span class="emphasis"><em>imag</em></span> operators return the real and
-imaginary parts of the complex number as shown. The <span class="emphasis"><em>abs()</em></span> returns the absolute
-value of the complex number.</p>
-</div>
-<div class="section" title="4.2.Variables">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967346"></a>4.2.Variables</h3></div></div></div>
-<p id="ch2intro_3f">Variables are just names that represent a value. Variables have already been
-introduced in the various examples from the previous sections. Certain rules about
-using variables:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_40">Variables have to be initialized or assigned a value before being used.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_41">Variable names can consist of letters, digits and underscores(_).</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch2intro_42">Variable names cannot begin with digits, but can contain digits in them.</p></li>
-</ul></div>
-<p id="ch2intro_43">In reference to the previous section examples, 'a', 'b', 'lng', 'fl', 'e' and 'cplx'
-are all variables of various datatypes.</p>
-<pre class="programlisting">
-Note: Python is not a strongly typed language and hence an integer variable can at a
-later stage be used as a float variable as well.</pre>
-</div>
-<div class="section" title="4.3.Strings">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967394"></a>4.3.Strings</h3></div></div></div>
-<p id="ch2intro_44">Strings are one of the essential data structures of any programming language.
-The <code class="literal">print "Hello, World!"</code> program was introduced in the earlier section, and
-the <span class="emphasis"><em>"Hello, World!"</em></span> in the print statement is a string. A string is basically
-a set of characters. Strings can be represented in various ways shown below:</p>
-<pre class="programlisting">
-s = 'this is a string'              # a string variable can be represented using single quotes
-s = 'This one has "quotes" inside!' # The string can have quotes inside it as shown
-s = "I have 'single-quotes' inside!"
-l = "A string spanning many lines 
-one more line 
-yet another"                        # a string can span more than a single line.
-t = """A triple quoted string does  # another way of representing multiline strings.
-not need to be escaped at the end and
-"can have nested quotes" etc."""</pre>
-<p id="ch2intro_45">Try the following on the interpreter:
-<code class="literal">s = 'this is a string with 'quotes' of similar kind'</code></p>
-<p id="ch2intro_46"><span class="strong"><strong>Exercise: How to use single quotes within single quotes in a string as shown
-in the above example without getting an error?</strong></span></p>
-<div class="section" title="4.3.1.String operations">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2967445"></a>4.3.1.String operations</h4></div></div></div>
-<p id="ch2intro_47">A few basic string operations are presented here.</p>
-<p id="ch2intro_48"><span class="strong"><strong>String concatenation</strong></span>
-String concatenation is done by simple addition of two strings.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; x = 'Hello'
-&gt;&gt;&gt; y = ' Python'
-&gt;&gt;&gt; print x+y
-Hello Python</pre>
-<p id="ch2intro_49"><span class="emphasis"><em>Try this yourself:</em></span></p>
-<pre class="programlisting">
-&gt;&gt;&gt; somenum = 13
-&gt;&gt;&gt; print x+somenum</pre>
-<p id="ch2intro_4a">The problem with the above example is that here a string variable and an integer
-variable are trying to be concantenated. To obtain the desired result from the
-above example the str(), repr() and the `` can be used.</p>
-<p id="ch2intro_4b"><span class="strong"><strong>str()</strong></span> simply converts a value to a string in a reasonable form.
-<span class="strong"><strong>repr()</strong></span> creates a string that is a representation of the value.</p>
-<p id="ch2intro_4c">The difference can be seen in the example shown below:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; str(1000000000000000000000000000000000000000000000000L)
-'1000000000000000000000000000000000000000000000000'
-&gt;&gt;&gt; repr(1000000000000000000000000000000000000000000000000L)
-'1000000000000000000000000000000000000000000000000L'</pre>
-<p id="ch2intro_4d">It can be observed that the 'L' in the long value shown was omitted by str(),
-whereas repr() converted that into a string too. An alternative way of using
-repr(value) is <code class="literal">`value`</code>.</p>
-<p id="ch2intro_4e">A few more examples:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; x = "Let's go  nto Pycon"
-&gt;&gt;&gt; print x
-Let's go
-to Pycon</pre>
-<p id="ch2intro_4f">In the above example, notice that the 'n'(newline) character is formatted and
-the string is printed on two lines. The strings discussed until now were normal
-strings. Other than these there are two other types of strings namely, raw strings
-and unicode strings.</p>
-<p id="ch2intro_50"><span class="strong"><strong>Raw strings</strong></span> are strings which are unformatted, that is the backslashes() are
-not parsed and are left as it is in the string. Raw strings are represented with
-an 'r' at the start of a string.
-Let us look at an example</p>
-<pre class="programlisting">
-&gt;&gt;&gt; x = r"Let's go  nto Pycon"
-&gt;&gt;&gt; print x
-Let's go  nto Pycon</pre>
-<p id="ch2intro_51">Note: The 'n' is not being parsed into a new line and is left as it is.</p>
-<p id="ch2intro_52"><span class="emphasis"><em>Try this yourself:</em></span></p>
-<pre class="programlisting">
-&gt;&gt;&gt; x = r"Let's go to Pycon "</pre>
-<p id="ch2intro_53"><span class="strong"><strong>Unicode strings</strong></span> are strings where the characters are Unicode characters as
-opposed to ASCII characters. Unicode strings are represented with a 'u' at the
-start of the string.
-Let us look at an example:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; x = u"Let's go to Pycon!"
-&gt;&gt;&gt; print x
-Let's go to Pycon!</pre>
-</div>
-</div>
-<div class="section" title="4.4.Boolean">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967588"></a>4.4.Boolean</h3></div></div></div>
-<p id="ch2intro_54">Python also provides special Boolean datatype. A boolean variable can assume a
-value of either <span class="emphasis"><em>True</em></span> or <span class="emphasis"><em>False</em></span> (Note the capitalizations).</p>
-<p id="ch2intro_55">Let us look at examples:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; t = True
-&gt;&gt;&gt; f = not t
-&gt;&gt;&gt; print f
-False
-&gt;&gt;&gt; f or t
-True
-&gt;&gt;&gt; f and t
-False</pre>
-</div>
-</div>
-<div class="section" title="5.The while loop">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967617"></a>5.The <span class="strong"><strong>while</strong></span> loop</h2></div></div></div>
-<p id="ch2intro_56">The Python <span class="strong"><strong>while</strong></span> loop is similar to the C/C++ while loop. The syntax is as
-follows:</p>
-<pre class="programlisting">
-statement 0
-while condition:
-  statement 1 #while block
-  statement 2 #while block
-statement 3 #outside the while block.</pre>
-<p id="ch2intro_57">Let us look at an example:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; x = 1
-&gt;&gt;&gt; while x &lt;= 5:
-...   print x
-...   x += 1
-...
-1
-2
-3
-4
-5</pre>
-</div>
-<div class="section" title="6.The if conditional">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967654"></a>6.The <span class="strong"><strong>if</strong></span> conditional</h2></div></div></div>
-<p id="ch2intro_58">The Python <span class="strong"><strong>if</strong></span> block provides the conditional execution of statements.
-If the condition evaluates as true the block of statements defined under the if
-block are executed.</p>
-<p id="ch2intro_59">If the first block is not executed on account of the condition not being satisfied,
-the set of statements in the <span class="strong"><strong>else</strong></span> block are executed.</p>
-<p id="ch2intro_5a">The <span class="strong"><strong>elif</strong></span> block provides the functionality of evaluation of multiple conditions
-as shown in the example.</p>
-<p id="ch2intro_5b">The syntax is as follows:</p>
-<pre class="programlisting">
-if condition :
-    statement_1
-    statement_2
-
-elif condition:
-    statement_3
-    statement_4
-else:
-    statement_5
-    statement_6</pre>
-<p id="ch2intro_5c">Let us look at an example:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; n = raw_input("Input a number:")
-&gt;&gt;&gt; if n &lt; 0:
-      print n," is negative"
-      elif n &gt; 0:
-      print n," is positive"
-      else:
-      print n, " is 0"</pre>
-</div>
-<div class="section" title="7.raw_input()">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967723"></a>7.<span class="strong"><strong>raw_input()</strong></span>
-</h2></div></div></div>
-<p id="ch2intro_5d">In the previous example we saw the call to the raw_input() subroutine.
-The <span class="strong"><strong>raw_input()</strong></span> method is used to take user inputs through the console.
-Unlike <span class="strong"><strong>input()</strong></span> which assumes the data entered by the user as a standard python
-expression, <span class="strong"><strong>raw_input()</strong></span> treats all the input data as raw data and converts
-everything into a string. To illustrate this let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; input("Enter a number thats a palindrome:")
-Enter a number thats a palindrome:121
-121
-
-&gt;&gt;&gt; input("Enter your name:")
-Enter your name:PythonFreak
-Traceback (most recent call last):
-  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
-  File "&lt;string&gt;", line 1, in &lt;module&gt;
-NameError: name 'PythonFreak' is not defined</pre>
-<p id="ch2intro_5e">As shown above the <span class="strong"><strong>input()</strong></span> assumes that the data entered is a valid Python
-expression. In the first call it prompts for an integer input and when entered
-it accepts the integer as an integer, whereas in the second call, when the string
-is entered without the quotes, <span class="strong"><strong>input()</strong></span> assumes that the entered data is a valid
-Python expression and hence it raises and exception saying PythonFreak is not
-defined.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; input("Enter your name:")
-Enter your name:'PythonFreak'
-'PythonFreak'
-&gt;&gt;&gt;</pre>
-<p id="ch2intro_5f">Here the name is accepted because its entered as a string (within quotes). But
-its unreasonable to go on using quotes each time a string is entered. Hence the
-alternative is to use <span class="strong"><strong>raw_input()</strong></span>.</p>
-<p id="ch2intro_60">Let us now look at how <span class="strong"><strong>raw_input()</strong></span> operates with an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; raw_input("Enter your name:")
-Enter your name:PythonFreak
-'PythonFreak'</pre>
-<p id="ch2intro_61">Observe that the <span class="strong"><strong>raw_input()</strong></span> is converting it into a string all by itself.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; pal = raw_input("Enter a number thats a palindrome:")
-Enter a number thats a palindrome:121
-'121'</pre>
-<p id="ch2intro_62">Observe that <span class="strong"><strong>raw_input()</strong></span> is converting the integer 121 also to a string as
-'121'. Let us look at another example:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; pal = raw_input("Enter a number thats a palindrome:")
-Enter a number thats a palindrome:121
-&gt;&gt;&gt; pal + 2
-Traceback (most recent call last):
-  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
-TypeError: cannot concatenate 'str' and 'int' objects
-&gt;&gt;&gt; pal
-'121'</pre>
-<p id="ch2intro_63">Observe here that the variable <span class="emphasis"><em>pal</em></span> is a string and hence integer operations
-cannot be performed on it. Hence the exception is raised.</p>
-</div>
-<div class="section" title="8.int() method">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967877"></a>8.<span class="strong"><strong>int()</strong></span> method</h2></div></div></div>
-<p id="ch2intro_64">Generally for computing purposes, the data used is not strings or raw data but
-on integers, floats and similar mathematical data structures. The data obtained
-from <span class="strong"><strong>raw_input()</strong></span> is raw data in the form of strings. In order to obtain integers
-from strings we use the method <span class="strong"><strong>int()</strong></span>.</p>
-<p id="ch2intro_65">Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; intpal = int(pal)
-&gt;&gt;&gt; intpal
-121</pre>
-<p id="ch2intro_66">In the previous example it was observed that <span class="emphasis"><em>pal</em></span> was a string variable. Here
-using the <span class="strong"><strong>int()</strong></span> method the string <span class="emphasis"><em>pal</em></span> was converted to an integer variable.</p>
-<p id="ch2intro_67"><span class="emphasis"><em>Try This Yourself:</em></span></p>
-<pre class="programlisting">
-&gt;&gt;&gt; stringvar = raw_input("Enter a name:")
-Enter a name:Guido Van Rossum
-&gt;&gt;&gt; stringvar
-'Guido Van Rossum'
-&gt;&gt;&gt; numvar = int(stringvar)</pre>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch3list_tuples.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,522 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. list_tuples</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch3list_tuples">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2896388">Lists and Tuples</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2706433">1. Lists</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2896192">1.1. Common List Operations</a></span></dt>
-<dt><span class="section"><a href="#id2947658">1.2. None, Empty Lists, and Initialization</a></span></dt>
-<dt><span class="section"><a href="#id2947698">1.3. Nested Lists</a></span></dt>
-<dt><span class="section"><a href="#id2947732">1.4. List Methods</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2948048">2. Tuples</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2948145">2.1. Common Tuple Operations</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2948295">3. Additional Syntax</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2948312">3.1. range()</a></span></dt>
-<dt><span class="section"><a href="#id2948344">3.2. for</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2948403">4. Conclusion</a></span></dt>
-</dl></dd>
-</dl>
-</div>
-<div class="article" title="Lists and Tuples">
-<div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2896388"></a>Lists and Tuples</h2></div></div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2706433">1. Lists</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2896192">1.1. Common List Operations</a></span></dt>
-<dt><span class="section"><a href="#id2947658">1.2. None, Empty Lists, and Initialization</a></span></dt>
-<dt><span class="section"><a href="#id2947698">1.3. Nested Lists</a></span></dt>
-<dt><span class="section"><a href="#id2947732">1.4. List Methods</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2948048">2. Tuples</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2948145">2.1. Common Tuple Operations</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2948295">3. Additional Syntax</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2948312">3.1. range()</a></span></dt>
-<dt><span class="section"><a href="#id2948344">3.2. for</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2948403">4. Conclusion</a></span></dt>
-</dl>
-</div>
-<div class="section" title="1.Lists">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2706433"></a>1.Lists</h2></div></div></div>
-<p id="ch3list_tuples_1">Python provides an intuitive way to represent a group items, called <span class="emphasis"><em>Lists</em></span>. The
-items of a <span class="emphasis"><em>List</em></span> are called its elements. Unlike C/C++, elements can be of any
-type. A <span class="emphasis"><em>List</em></span> is represented as a list of comma-sepated elements with square
-brackets around them:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [10, 'Python programming', 20.3523, 23, 3534534L]
-&gt;&gt;&gt; a
-[10, 'Python programming', 20.3523, 23, 3534534L]</pre>
-<div class="section" title="1.1.Common List Operations">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2896192"></a>1.1.Common List Operations</h3></div></div></div>
-<p id="ch3list_tuples_2">The following are some of the most commonly used operations on <span class="emphasis"><em>Lists</em></span>.</p>
-<div class="section" title="1.1.1.Indexing">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2896236"></a>1.1.1.Indexing</h4></div></div></div>
-<p id="ch3list_tuples_3">Individual elements of a <span class="emphasis"><em>List</em></span> can be accessed using an index to the element.
-The indices start at 0. One can also access the elements of the <span class="emphasis"><em>List</em></span> in reverse
-using negative indices.:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a[1]
-'Python programming'
-&gt;&gt;&gt; a[-1]
-3534534L</pre>
-<p id="ch3list_tuples_4">It is important to note here that the last element of the <span class="emphasis"><em>List</em></span> has an index of
--1.</p>
-</div>
-<div class="section" title="1.1.2.Concatenating">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947372"></a>1.1.2.Concatenating</h4></div></div></div>
-<p id="ch3list_tuples_5">Two or more <span class="emphasis"><em>Lists</em></span> can be concatenated using the + operator:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a + ['foo', 12, 23.3432, 54]
-[10, 'Python programming', 20.3523, 'foo', 12, 23.3432, 54]
-&gt;&gt;&gt; [54, 75, 23] + ['write', 67, 'read']
-[54, 75, 23, 'write', 67, 'read']</pre>
-</div>
-<div class="section" title="1.1.3.Slicing">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947393"></a>1.1.3.Slicing</h4></div></div></div>
-<p id="ch3list_tuples_6">A <span class="emphasis"><em>List</em></span> can be sliced off to contain a subset of elements of the <span class="emphasis"><em>List</em></span>. Slicing
-can be done by using two indices separated by a colon, where the first index is
-inclusive and the second index is exclusive. The resulting slice is also a <span class="emphasis"><em>List</em></span>.:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
-&gt;&gt;&gt; num[3:6]
-[4, 5, 6]
-&gt;&gt;&gt; num[0:1]
-[1]
-&gt;&gt;&gt; num[7:10]
-[7, 8, 9]</pre>
-<p id="ch3list_tuples_7">The last example showed how to access last 3 elements of the <span class="emphasis"><em>List</em></span>. There is a
-small catch here. The second index 10 actually refers to the 11th element of the
-<span class="emphasis"><em>List</em></span> which is still valid, even though it doesn't exist because the second
-index is exclusive and tells the Python interpreter to get the last element of
-the <span class="emphasis"><em>List</em></span>. But this can also be done in a much easier way using negative indices:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; num[-3:-1]
-[7, 8, 9]</pre>
-<p id="ch3list_tuples_8">Excluding the first index implies that the slice must start at the beginning of
-the <span class="emphasis"><em>List</em></span>, while excluding the second index includes all the elements till the
-end of the <span class="emphasis"><em>List</em></span>. A third parameter to a slice, which is implicitly taken as 1
-is the step of the slice. It is specified as a value which follows a colon after
-the second index:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; num[:4]
-[1, 2, 3, 4]
-&gt;&gt;&gt; num[7:]
-[8, 9]
-&gt;&gt;&gt; num[-3:]
-[7, 8, 9]
-&gt;&gt;&gt; num[:]
-[1, 2, 3, 4, 5, 6, 7, 8, 9]
-&gt;&gt;&gt; num[4:9:3]
-[5, 8]
-&gt;&gt;&gt; num[3::2]
-[4, 6, 8]
-&gt;&gt;&gt; num[::4]
-[1, 5, 9]</pre>
-</div>
-<div class="section" title="1.1.4.Multiplication">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947472"></a>1.1.4.Multiplication</h4></div></div></div>
-<p id="ch3list_tuples_9">A <span class="emphasis"><em>List</em></span> can be multiplied with an integer to repeat itself:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; [20] * 5
-[20, 20, 20, 20, 20]
-&gt;&gt;&gt; [42, 'Python', 54] * 3
-[42, 'Python', 54, 42, 'Python', 54, 42, 'Python', 54]</pre>
-</div>
-<div class="section" title="1.1.5.Membership">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947497"></a>1.1.5.Membership</h4></div></div></div>
-<p id="ch3list_tuples_a"><span class="strong"><strong>in</strong></span> operator is used to find whether an element is part of the <span class="emphasis"><em>List</em></span>. It
-returns <span class="strong"><strong>True</strong></span> if the element is present in the <span class="emphasis"><em>List</em></span> or <span class="strong"><strong>False</strong></span> if it is not
-present. Since this operator returns a Boolean value it is called a Boolean
-operator:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; names = ['Guido', 'Alex', 'Tim']
-&gt;&gt;&gt; 'Tim' in names
-True
-&gt;&gt;&gt; 'Adam' in names
-False</pre>
-</div>
-<div class="section" title="1.1.6.Length, Maximum and Minimum">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947539"></a>1.1.6.Length, Maximum and Minimum</h4></div></div></div>
-<p id="ch3list_tuples_b">Length of a <span class="emphasis"><em>List</em></span> can be found out using the len function. The max function
-returns the element with the largest value and the min function returns the
-element with the smallest value:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; num = [4, 1, 32, 12, 67, 34, 65]
-&gt;&gt;&gt; len(num)
-7
-&gt;&gt;&gt; max(num)
-67
-&gt;&gt;&gt; min(num)
-1</pre>
-</div>
-<div class="section" title="1.1.7.Changing Elements">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947564"></a>1.1.7.Changing Elements</h4></div></div></div>
-<p id="ch3list_tuples_c">Unlike Strings <span class="emphasis"><em>Lists</em></span> are mutable, i.e. elements of a <span class="emphasis"><em>List</em></span> can be manipulated:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [1, 3, 5, 7]
-&gt;&gt;&gt; a[2] = 9
-&gt;&gt;&gt; a
-[1, 3, 9, 7]</pre>
-</div>
-<div class="section" title="1.1.8.Deleting Elements">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947590"></a>1.1.8.Deleting Elements</h4></div></div></div>
-<p id="ch3list_tuples_d">An element or a slice of a <span class="emphasis"><em>List</em></span> can be deleted by using the <span class="strong"><strong>del</strong></span> statement:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [1, 3, 5, 7, 9, 11]
-&gt;&gt;&gt; del a[-2:]
-&gt;&gt;&gt; a
-[1, 3, 5, 7]
-&gt;&gt;&gt; del a[1]
-&gt;&gt;&gt; a
-[1, 5, 7]</pre>
-</div>
-<div class="section" title="1.1.9.Assign to Slices">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947617"></a>1.1.9.Assign to Slices</h4></div></div></div>
-<p id="ch3list_tuples_e">In the same way, values can be assigned to individual elements of the <span class="emphasis"><em>List</em></span>,
-a <span class="emphasis"><em>List</em></span> of elements can be assigned to a slice:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [2, 3, 4, 5]
-&gt;&gt;&gt; a[:2] = [0, 1]
-[0, 1, 4, 5]
-&gt;&gt;&gt; a[2:2] = [2, 3]
-&gt;&gt;&gt; a
-[0, 1, 2, 3, 4, 5]
-&gt;&gt;&gt; a[2:4] = []
-&gt;&gt;&gt; a
-[0, 1, 4, 5]</pre>
-<p id="ch3list_tuples_f">The last two examples should be particularly noted carefully. The last but one
-example insert elements or a list of elements into a <span class="emphasis"><em>List</em></span> and the last example
-deletes a list of elements from the <span class="emphasis"><em>List</em></span>.</p>
-</div>
-</div>
-<div class="section" title="1.2.None, Empty Lists, and Initialization">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2947658"></a>1.2.None, Empty Lists, and Initialization</h3></div></div></div>
-<p id="ch3list_tuples_10">An <span class="emphasis"><em>Empty List</em></span> is a <span class="emphasis"><em>List</em></span> with no elements and is simply represented as
-[]. A <span class="emphasis"><em>None List</em></span> is one with all elements in it being <span class="strong"><strong>None</strong></span>. It serves
-the purpose having a container list of some fixed number of elements with
-no value:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = []
-&gt;&gt;&gt; a
-[]
-&gt;&gt;&gt; n = [None] * 10
-&gt;&gt;&gt; n
-[None, None, None, None, None, None, None, None, None, None]</pre>
-</div>
-<div class="section" title="1.3.Nested Lists">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2947698"></a>1.3.Nested Lists</h3></div></div></div>
-<p id="ch3list_tuples_11">As mentioned earlier, a List can contain elements of any data type. This also
-implies a <span class="emphasis"><em>List</em></span> can have a <span class="emphasis"><em>Lists</em></span> themselves as its elements. These are
-called as <span class="emphasis"><em>Nested Lists</em></span>. There is no limit on the depth of the <span class="emphasis"><em>Nested Lists</em></span>:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [1, [1, 2, 3], 3, [1, [1, 2, 3]], 7]</pre>
-</div>
-<div class="section" title="1.4.List Methods">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2947732"></a>1.4.List Methods</h3></div></div></div>
-<p id="ch3list_tuples_12">A method is a function that is coupled to an object. More about objects
-and its methods are discussed in Advanced Python module. In general, a
-method is called like:</p>
-<pre class="programlisting">
-object.method(arguments)</pre>
-<p id="ch3list_tuples_13">For now, it is enough to know that a list of elements is an object and
-so <span class="emphasis"><em>List</em></span> methods can be called upon them. Also some of the methods change
-the <span class="emphasis"><em>List</em></span> in-place, meaning it modifies the existing list instead of creating
-a new one, while other methods don't. It must be noted as we run through
-the <span class="emphasis"><em>List</em></span> methods.</p>
-<p id="ch3list_tuples_14">Some of the most commonly used <span class="emphasis"><em>List</em></span> methods are as follows:</p>
-<div class="section" title="1.4.1.append">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947779"></a>1.4.1.append</h4></div></div></div>
-<p id="ch3list_tuples_15">The <span class="emphasis"><em>append</em></span> method is used to append an object at the end of the list:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; prime = [2, 3, 5]
-&gt;&gt;&gt; prime.append(7)
-&gt;&gt;&gt; prime
-[2, 3, 5, 7]</pre>
-<p id="ch3list_tuples_16">It is important to note that append changes the <span class="emphasis"><em>List</em></span> in-place.</p>
-</div>
-<div class="section" title="1.4.2.count">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947808"></a>1.4.2.count</h4></div></div></div>
-<p id="ch3list_tuples_17">The <span class="emphasis"><em>count</em></span> method returns the number of occurences of a particular element
-in a list:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; [1, 4, 4, 9, 9, 9].count(9)
-3
-&gt;&gt;&gt; tlst = ['Python', 'is', 'a', 'beautiful', 'language']
-&gt;&gt;&gt; tlst.count('Python')
-1</pre>
-</div>
-<div class="section" title="1.4.3.extend">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947831"></a>1.4.3.extend</h4></div></div></div>
-<p id="ch3list_tuples_18">The <span class="emphasis"><em>extend</em></span> method extends the list on which it is called by the list supplied
-as argument to it:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [1, 2, 3]
-&gt;&gt;&gt; b = [4, 5, 6]
-&gt;&gt;&gt; a.extend(b)
-[1, 2, 3, 4, 5, 6]</pre>
-<p id="ch3list_tuples_19">This is an in-place method. This method is equivalent to using the + operator, but
-using the + operator returns a new list.</p>
-</div>
-<div class="section" title="1.4.4.index">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947859"></a>1.4.4.index</h4></div></div></div>
-<p id="ch3list_tuples_1a">The <span class="emphasis"><em>index</em></span> method returns the index position of the element in the list
-specified as argument:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [1, 2, 3, ,4, 5]
-&gt;&gt;&gt; a.index(4)
-3</pre>
-</div>
-<div class="section" title="1.4.5.insert">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947879"></a>1.4.5.insert</h4></div></div></div>
-<p id="ch3list_tuples_1b">The <span class="emphasis"><em>insert</em></span> method is used to insert an element specified as the second
-argument to the list at the position specified by the first argument:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = ['Python', 'is', 'cool']
-&gt;&gt;&gt; a.insert(2, 'so')
-&gt;&gt;&gt; a
-['Python', 'is', 'so', 'cool']</pre>
-<p id="ch3list_tuples_1c">The <span class="emphasis"><em>insert</em></span> method changes the <span class="emphasis"><em>List</em></span> in-place.</p>
-</div>
-<div class="section" title="1.4.6.pop">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947913"></a>1.4.6.pop</h4></div></div></div>
-<p id="ch3list_tuples_1d">The <span class="emphasis"><em>pop</em></span> method removes an element from the list. The index position
-of the element to be removed can be specified as an argument to the
-<span class="emphasis"><em>pop</em></span> method, if not it removes the last element by default:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [1, 2, 3, 4, 5]
-&gt;&gt;&gt; a.pop()
-&gt;&gt;&gt; a
-5
-&gt;&gt;&gt; a.pop(2)
-&gt;&gt;&gt; a
-3</pre>
-<p id="ch3list_tuples_1e">The <span class="emphasis"><em>pop</em></span> method changes the <span class="emphasis"><em>List</em></span> in-place.</p>
-</div>
-<div class="section" title="1.4.7.remove">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947951"></a>1.4.7.remove</h4></div></div></div>
-<p id="ch3list_tuples_1f">The <span class="emphasis"><em>remove</em></span> method removes the first occurence of an element supplied as a
-parameter:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [1, 2, 3, 4, 2, 5, 2]
-&gt;&gt;&gt; a.remove(2)
-&gt;&gt;&gt; a
-[1, 3, 4, 2, 5, 2]</pre>
-</div>
-<div class="section" title="1.4.8.reverse">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947972"></a>1.4.8.reverse</h4></div></div></div>
-<p id="ch3list_tuples_20">The <span class="emphasis"><em>reverse</em></span> method reverses elements in the list. It is important to note
-here that <span class="emphasis"><em>reverse</em></span> method changes the list in-place and doesn't return any
-thing:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = ['guido', 'alex', 'tim']
-&gt;&gt;&gt; a.reverse()
-&gt;&gt;&gt; a
-['tim', 'alex', 'guido']</pre>
-</div>
-<div class="section" title="1.4.9.sort">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2947998"></a>1.4.9.sort</h4></div></div></div>
-<p id="ch3list_tuples_21">The <span class="emphasis"><em>sort</em></span> method is used to sort the elements of the list. The <span class="emphasis"><em>sort</em></span> method
-also sorts in-place and does not return anything:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [5, 1, 3, 7, 4]
-&gt;&gt;&gt; a.sort()
-&gt;&gt;&gt; a
-[1, 3, 4, 5, 7]</pre>
-<p id="ch3list_tuples_22">In addition to the sort method on a <span class="emphasis"><em>List</em></span> object we can also use the built-in
-<span class="strong"><strong>sorted</strong></span> function. This function takes the <span class="emphasis"><em>List</em></span> as a parameter and returns
-a sorted copy of the list. However the original list is left intact:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = [5, 1, 3, 7, 4]
-&gt;&gt;&gt; b = sorted(a)
-&gt;&gt;&gt; b
-[1, 3, 4, 5, 7]
-&gt;&gt;&gt; a
-[5, 1, 3, 7, 4]</pre>
-</div>
-</div>
-</div>
-<div class="section" title="2.Tuples">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2948048"></a>2.Tuples</h2></div></div></div>
-<p id="ch3list_tuples_23"><span class="emphasis"><em>Tuples</em></span> are sequences just like <span class="emphasis"><em>Lists</em></span>, but they are immutable. In other
-words <span class="emphasis"><em>Tuples</em></span> provides a way to represent a group of items, where the group
-of items cannot be changed in any way. The syntax of a <span class="emphasis"><em>Tuple</em></span> is also very
-similar to <span class="emphasis"><em>List</em></span>. A <span class="emphasis"><em>Tuple</em></span> is represented with the list of items, called
-elements of the <span class="emphasis"><em>Tuple</em></span> separated by comma, with the entire list being enclosed
-in parenthesis. It is not compulsory to use parenthesis around a <span class="emphasis"><em>Tuple</em></span> but
-it may be necessary in some of the cases:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = 1, 2, 3
-&gt;&gt;&gt; a
-(1, 2, 3)
-&gt;&gt;&gt; b = 1,
-&gt;&gt;&gt; b
-(1,)</pre>
-<p id="ch3list_tuples_24">It is interesting to note the second example. Just a value followed by a comma
-automatically makes that an element of a <span class="emphasis"><em>Tuple</em></span> with only one element. It is
-also important to note that, irrespective of input having a parenthesis, the
-output always has a parenthesis.</p>
-<p id="ch3list_tuples_25">The first example is also known as <span class="emphasis"><em>Tuple packing</em></span>, because values are being
-packed into a tuple. It is also possible to do <span class="emphasis"><em>Tuple unpacking</em></span> which is more
-interesting. It is better to understand that by example. Say we have a
-co-ordinate pair from which we need to separate x and y co-ordinates:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = (1, 2)
-&gt;&gt;&gt; x, y = a
-&gt;&gt;&gt; x
-1
-&gt;&gt;&gt; y
-2</pre>
-<p id="ch3list_tuples_26"><span class="emphasis"><em>Tuple unpacking</em></span> also has several other use-cases of which the most interesting
-one is to swap the values of two variables. Using programming languages like C
-would require anywhere around 10 lines of code and an extra temporary variable
-to do this (including all the #include stuff). Python does it in the most
-intuitive way in just one line. Say we want to swap the co-ordinates in the
-above example:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; x, y = y, x
-&gt;&gt;&gt; x
-2
-&gt;&gt;&gt; y
-1</pre>
-<div class="section" title="2.1.Common Tuple Operations">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2948145"></a>2.1.Common Tuple Operations</h3></div></div></div>
-<p id="ch3list_tuples_27">There is no need to introduce all the <span class="emphasis"><em>Tuple</em></span> operations again, since <span class="emphasis"><em>Tuples</em></span>
-support the following operations that <span class="emphasis"><em>List</em></span> supports in exactly the same way:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_28">Indexing</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_29">Concatenating</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_2a">Slicing</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_2b">Membership</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_2c">Multiplication</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_2d">Length, Maximum, Minimum</p></li>
-</ul></div>
-<p id="ch3list_tuples_2e">The following examples illustrate the above operations:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; a = (1, 2, 3, 4, 5, 6)
-&gt;&gt;&gt; a[5]
-6
-&gt;&gt;&gt; b = (7, 8, 9)
-&gt;&gt;&gt; a + b
-(1, 2, 3, 4, 5, 6, 7, 8, 9)
-&gt;&gt;&gt; a[3:5]
-(4, 5)
-&gt;&gt;&gt; 5 in a
-True
-&gt;&gt;&gt; c = (1,)
-&gt;&gt;&gt; c * 5
-(1, 1, 1, 1, 1)
-&gt;&gt;&gt; len(a)
-6
-&gt;&gt;&gt; max(a)
-6
-&gt;&gt;&gt; min(a)
-1</pre>
-<p id="ch3list_tuples_2f">However the following <span class="emphasis"><em>List</em></span> operations are not supported by <span class="emphasis"><em>Tuples</em></span> because
-<span class="emphasis"><em>Tuples</em></span> cannot be changed once they are created:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_30">Changing elements</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_31">Deleting elements</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch3list_tuples_32">Assigning to slices</p></li>
-</ul></div>
-<p id="ch3list_tuples_33">Similarity to <span class="emphasis"><em>Lists</em></span> leads to the questions like, why not <span class="emphasis"><em>Lists</em></span> only? Why do
-we even want <span class="emphasis"><em>Tuples</em></span>? Can we do the same with <span class="emphasis"><em>Lists</em></span>? And the answer is <span class="strong"><strong>Yes</strong></span>
-we can do it, but <span class="emphasis"><em>Tuples</em></span> are helpful at times, like we can return Tuples from
-functions. They are also returned by some built-in functions and methods. And
-also there are some use cases like co-ordinate among other things. So <span class="emphasis"><em>Tuples</em></span>
-are helpful.</p>
-</div>
-</div>
-<div class="section" title="3.Additional Syntax">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2948295"></a>3.Additional Syntax</h2></div></div></div>
-<p id="ch3list_tuples_34">The following additional syntax are introduced to make it easier to operate on
-<span class="emphasis"><em>Lists</em></span>.</p>
-<div class="section" title="3.1.range()">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2948312"></a>3.1.range()</h3></div></div></div>
-<p id="ch3list_tuples_35">The <span class="emphasis"><em>range</em></span> function takes at least one argument and 2 additional optional
-arguments. If two or more arguments are specified, the range function returns
-a list of natural numbers starting from the first argument passed to it to the
-second argument. The third argument, if specified is used as a step. Suppose
-only one argument is specified, then <span class="emphasis"><em>range</em></span> function returns a list of natural
-numbers starting from 0 upto the argument specified:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; range(5, 10, 2)
-[5, 7, 9]
-&gt;&gt;&gt; range(2, 15)
-[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
-&gt;&gt;&gt; range(12)
-[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]</pre>
-</div>
-<div class="section" title="3.2.for">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2948344"></a>3.2.for</h3></div></div></div>
-<p id="ch3list_tuples_36">The <span class="strong"><strong>for</strong></span> keyword is used as a part of the looping construct. Unlike for loops
-in other languages, Python's for is used to iterate through the elements of
-sequences like <span class="emphasis"><em>Lists</em></span>, <span class="emphasis"><em>Tuples</em></span>, <span class="emphasis"><em>Dictionaries</em></span>, etc. The syntax of the for loop
-consists of <span class="strong"><strong>for</strong></span>, followed by a variable to hold the individual or the current
-element of the list during iteration and <span class="strong"><strong>in</strong></span>, followed by the sequence and a
-semicolon(':') The next line which is part of the <span class="strong"><strong>for</strong></span> loop, i.e the statements
-that are part of the loop should start with a new intend:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; names = ['Guido', 'Alex', 'Tim']
-&gt;&gt;&gt; for name in names:
-...   print "Name =", name
-...
-Name = Guido
-Name = Alex
-Name = Tim</pre>
-</div>
-</div>
-<div class="section" title="4.Conclusion">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2948403"></a>4.Conclusion</h2></div></div></div>
-<p id="ch3list_tuples_37">This section on <span class="emphasis"><em>Lists</em></span> and <span class="emphasis"><em>Tuples</em></span> introduces almost all the necessary
-machinary required to work on <span class="emphasis"><em>Lists</em></span> and <span class="emphasis"><em>Tuples</em></span>. Topics like how to
-use these data structures in bigger more useful programs will be introduced
-in the subsequent chapters.</p>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch4strings_dicts.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,487 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. strings_dicts</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch4strings_dicts">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2983086">Strings</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2981673">1. String Formatting</a></span></dt>
-<dt><span class="section"><a href="#id3034090">2. String Methods</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id3034105">2.1. <span class="strong"><strong>find</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034135">2.2. <span class="strong"><strong>join</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034175">2.3. <span class="strong"><strong>lower</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034206">2.4. <span class="strong"><strong>replace</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034262">2.5. <span class="strong"><strong>split</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034321">2.6. <span class="strong"><strong>strip</strong></span></a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id3034366">3. Introduction to the standard library</a></span></dt>
-<dt><span class="section"><a href="#id3034442">4. I/O: Reading and Writing Files</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id3034472">4.1. Opening Files</a></span></dt>
-<dt><span class="section"><a href="#id3034646">4.2. Reading and Writing files</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id3034811">5. Dictionaries</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id3034868">5.1. <span class="strong"><strong>dict()</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034932">5.2. Dictionary Methods</a></span></dt>
-</dl></dd>
-</dl></dd>
-</dl>
-</div>
-<div class="article" title="Strings">
-<div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2983086"></a>Strings</h2></div></div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2981673">1. String Formatting</a></span></dt>
-<dt><span class="section"><a href="#id3034090">2. String Methods</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id3034105">2.1. <span class="strong"><strong>find</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034135">2.2. <span class="strong"><strong>join</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034175">2.3. <span class="strong"><strong>lower</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034206">2.4. <span class="strong"><strong>replace</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034262">2.5. <span class="strong"><strong>split</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034321">2.6. <span class="strong"><strong>strip</strong></span></a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id3034366">3. Introduction to the standard library</a></span></dt>
-<dt><span class="section"><a href="#id3034442">4. I/O: Reading and Writing Files</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id3034472">4.1. Opening Files</a></span></dt>
-<dt><span class="section"><a href="#id3034646">4.2. Reading and Writing files</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id3034811">5. Dictionaries</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id3034868">5.1. <span class="strong"><strong>dict()</strong></span></a></span></dt>
-<dt><span class="section"><a href="#id3034932">5.2. Dictionary Methods</a></span></dt>
-</dl></dd>
-</dl>
-</div>
-<p id="ch4strings_dicts_1">Strings were briefly introduced previously in the introduction document. In this
-section strings will be presented in greater detail. All the standard operations
-that can be performed on sequences such as indexing, slicing, multiplication, length
-minimum and maximum can be performed on string variables as well. One thing to
-be noted is that strings are immutable, which means that string variables are
-unchangeable. Hence, all item and slice assignments on strings are illegal.
-Let us look at a few example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; name = 'PythonFreak'
-&gt;&gt;&gt; print name[3]
-h
-&gt;&gt;&gt; print name[-1]
-k
-&gt;&gt;&gt; print name[6:]
-Freak
-&gt;&gt;&gt; name[6:0] = 'Maniac'
-Traceback (most recent call last):
-  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
-TypeError: 'str' object does not support item assignment</pre>
-<p id="ch4strings_dicts_2">This is quite expected, since string objects are immutable as already mentioned.
-The error message is clear in mentioning that 'str' object does not support item
-assignment.</p>
-<div class="section" title="1.String Formatting">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2981673"></a>1.String Formatting</h2></div></div></div>
-<p id="ch4strings_dicts_3">String formatting can be performed using the string formatting operator represented
-as the percent (%) sign. The string placed before the % sign is formatted with
-the value placed to the right of it. Let us look at a simple example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; format = 'Hello %s, from PythonFreak'
-&gt;&gt;&gt; str1 = 'world!'
-&gt;&gt;&gt; print format % str1
-Hello world!, from PythonFreak</pre>
-<p id="ch4strings_dicts_4">The %s parts of the format string are called the coversion specifiers. The coversion
-specifiers mark the places where the formatting has to be performed in a string.
-In the example the %s is replaced by the value of str1. More than one value can
-also be formatted at a time by specifying the values to be formatted using tuples
-and dictionaries (explained in later sections). Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; format = 'Hello %s, from %s'
-&gt;&gt;&gt; values = ('world!', 'PythonFreak')
-&gt;&gt;&gt; print format % values
-Hello world!, from PythonFreak</pre>
-<p id="ch4strings_dicts_5">In this example it can be observed that the format string contains two conversion
-specifiers and they are formatted using the tuple of values as shown.</p>
-<p id="ch4strings_dicts_6">The s in %s specifies that the value to be replaced is of type string. Values of
-other types can be specified as well such as integers and floats. Integers are
-specified as %d and floats as %f. The precision with which the integer or the
-float values are to be represented can also be specified using a <span class="strong"><strong>.</strong></span> (<span class="strong"><strong>dot</strong></span>)
-followed by the precision value.</p>
-</div>
-<div class="section" title="2.String Methods">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id3034090"></a>2.String Methods</h2></div></div></div>
-<p id="ch4strings_dicts_7">Similar to list methods, strings also have a rich set of methods to perform various
-operations on strings. Some of the most important and popular ones are presented
-in this section.</p>
-<div class="section" title="2.1.find">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034105"></a>2.1.<span class="strong"><strong>find</strong></span>
-</h3></div></div></div>
-<p id="ch4strings_dicts_8">The <span class="strong"><strong>find</strong></span> method is used to search for a substring within a given string. It
-returns the left most index of the first occurence of the substring. If the
-substring is not found in the string then it returns -1. Let us look at a few
-examples.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; longstring = 'Hello world!, from PythonFreak'
-&gt;&gt;&gt; longstring.find('Python')
-19
-&gt;&gt;&gt; longstring.find('Perl')
--1</pre>
-</div>
-<div class="section" title="2.2.join">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034135"></a>2.2.<span class="strong"><strong>join</strong></span>
-</h3></div></div></div>
-<p id="ch4strings_dicts_9">The <span class="strong"><strong>join</strong></span> method is used to join the elements of a sequence. The sequence
-elements that are to be join ed should all be strings. Let us look at a few
-examples.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; seq = ['With', 'great', 'power', 'comes', 'great', 'responsibility']
-&gt;&gt;&gt; sep = ' '
-&gt;&gt;&gt; sep.join(seq)
-'With great power comes great responsibility'
-&gt;&gt;&gt; sep = ',!'
-&gt;&gt;&gt; sep.join(seq)
-'With,!great,!power,!comes,!great,!responsibility'</pre>
-<p id="ch4strings_dicts_a"><span class="emphasis"><em>Try this yourself</em></span></p>
-<pre class="programlisting">
-&gt;&gt;&gt; seq = [12,34,56,78]
-&gt;&gt;&gt; sep.join(seq)</pre>
-</div>
-<div class="section" title="2.3.lower">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034175"></a>2.3.<span class="strong"><strong>lower</strong></span>
-</h3></div></div></div>
-<p id="ch4strings_dicts_b">The <span class="strong"><strong>lower</strong></span> method, as the name indicates, converts the entire text of a string
-to lower case. It is specially useful in cases where the programmers deal with case
-insensitive data. Let us look at a few examples.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; sometext = 'Hello world!, from PythonFreak'
-&gt;&gt;&gt; sometext.lower()
-'hello world!, from pythonfreak'</pre>
-</div>
-<div class="section" title="2.4.replace">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034206"></a>2.4.<span class="strong"><strong>replace</strong></span>
-</h3></div></div></div>
-<p id="ch4strings_dicts_c">The <span class="strong"><strong>replace</strong></span> method replaces a substring with another substring within
-a given string and returns the new string. Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; sometext = 'Concise, precise and criticise is some of the words that end with ise'
-&gt;&gt;&gt; sometext.replace('is', 'are')
-'Concaree, precaree and criticaree are some of the words that end with aree'</pre>
-<p id="ch4strings_dicts_d">Observe here that all the occurences of the substring <span class="emphasis"><em>is</em></span> have been replaced,
-even the <span class="emphasis"><em>is</em></span> in <span class="emphasis"><em>concise</em></span>, <span class="emphasis"><em>precise</em></span> and <span class="emphasis"><em>criticise</em></span> have been replaced.</p>
-</div>
-<div class="section" title="2.5.split">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034262"></a>2.5.<span class="strong"><strong>split</strong></span>
-</h3></div></div></div>
-<p id="ch4strings_dicts_e">The <span class="strong"><strong>split</strong></span> is one of the very important string methods. split is the opposite of the
-<span class="strong"><strong>join</strong></span> method. It is used to split a string based on the argument passed as the
-delimiter. It returns a list of strings. By default when no argument is passed it
-splits with <span class="emphasis"><em>space</em></span> (' ') as the delimiter. Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; grocerylist = 'butter, cucumber, beer(a grocery item??), wheatbread'
-&gt;&gt;&gt; grocerylist.split(',')
-['butter', ' cucumber', ' beer(a grocery item??)', ' wheatbread']
-&gt;&gt;&gt; grocerylist.split()
-['butter,', 'cucumber,', 'beer(a', 'grocery', 'item??),', 'wheatbread']</pre>
-<p id="ch4strings_dicts_f">Observe here that in the second case when the delimiter argument was not set
-<span class="strong"><strong>split</strong></span> was done with <span class="emphasis"><em>space</em></span> as the delimiter.</p>
-</div>
-<div class="section" title="2.6.strip">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034321"></a>2.6.<span class="strong"><strong>strip</strong></span>
-</h3></div></div></div>
-<p id="ch4strings_dicts_10">The <span class="strong"><strong>strip</strong></span> method is used to remove or <span class="strong"><strong>strip</strong></span> off any whitespaces that exist
-to the left and right of a string, but not the whitespaces within a string. Let
-us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; spacedtext = "               Where's the text??                 "
-&gt;&gt;&gt; spacedtext.strip()
-"Where's the text??"</pre>
-<p id="ch4strings_dicts_11">Observe that the whitespaces between the words have not been removed.</p>
-<pre class="programlisting">
-Note: Very important thing to note is that all the methods shown above do not
-      transform the source string. The source string still remains the same.
-      Remember that **strings are immutable**.</pre>
-</div>
-</div>
-<div class="section" title="3.Introduction to the standard library">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id3034366"></a>3.Introduction to the standard library</h2></div></div></div>
-<p id="ch4strings_dicts_12">Python is often referred to as a "Batteries included!" language, mainly because
-of the Python Standard Library. The Python Standard Library provides an extensive
-set of features some of which are available directly for use while some require to
-import a few <span class="strong"><strong>modules</strong></span>. The Standard Library provides various built-in functions
-like:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch4strings_dicts_13"><span class="strong"><strong>abs()</strong></span></p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch4strings_dicts_14"><span class="strong"><strong>dict()</strong></span></p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch4strings_dicts_15"><span class="strong"><strong>enumerate()</strong></span></p></li>
-</ul></div>
-<p id="ch4strings_dicts_16">The built-in constants like <span class="strong"><strong>True</strong></span> and <span class="strong"><strong>False</strong></span> are provided by the Standard Library.
-More information about the Python Standard Library is available </p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://docs.python.org/library/</div>
-</div>
-<div class="section" title="4.I/O: Reading and Writing Files">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id3034442"></a>4.I/O: Reading and Writing Files</h2></div></div></div>
-<p id="ch4strings_dicts_17">Files are very important aspects when it comes to computing and programming.
-Up until now the focus has been on small programs that interacted with users
-through <span class="strong"><strong>input()</strong></span> and <span class="strong"><strong>raw_input()</strong></span>. Generally, for computational purposes
-it becomes necessary to handle files, which are usually large in size as well.
-This section focuses on basics of file handling.</p>
-<div class="section" title="4.1.Opening Files">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034472"></a>4.1.Opening Files</h3></div></div></div>
-<p id="ch4strings_dicts_18">Files can be opened using the <span class="strong"><strong>open()</strong></span> method. <span class="strong"><strong>open()</strong></span> accepts 3 arguments
-out of which 2 are optional. Let us look at the syntax of <span class="strong"><strong>open()</strong></span>:</p>
-<p id="ch4strings_dicts_19"><span class="emphasis"><em>f = open( filename, mode, buffering)</em></span></p>
-<p id="ch4strings_dicts_1a">The <span class="emphasis"><em>filename</em></span> is a compulsory argument while the <span class="emphasis"><em>mode</em></span> and <span class="emphasis"><em>buffering</em></span> are
-optional. The <span class="emphasis"><em>filename</em></span> should be a string and it should be the complete path
-to the file to be opened (The path can be absolute or relative). Let us look at
-an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; f = open ('basic_python/interim_assessment.rst')</pre>
-<p id="ch4strings_dicts_1b">The <span class="emphasis"><em>mode</em></span> argument specifies the mode in which the file has to be opened.
-The following are the valid mode arguments:</p>
-<p id="ch4strings_dicts_1c"><span class="strong"><strong>r</strong></span> - Read mode
-<span class="strong"><strong>w</strong></span> - Write mode
-<span class="strong"><strong>a</strong></span> - Append mode
-<span class="strong"><strong>b</strong></span> - Binary mode
-<span class="strong"><strong>+</strong></span> - Read/Write mode</p>
-<p id="ch4strings_dicts_1d">The read mode opens the file as a read-only document. The write mode opens the
-file in the Write only mode. In the write mode, if the file existed prior to the
-opening, the previous contents of the file are erased. The append mode opens the
-file in the write mode but the previous contents of the file are not erased and
-the current data is appended onto the file.
-The binary and the read/write modes are special in the sense that they are added
-onto other modes. The read/write mode opens the file in the reading and writing
-mode combined. The binary mode can be used to open a files that do not contain
-text. Binary files such as images should be opened in the binary mode. Let us look
-at a few examples.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; f = open ('basic_python/interim_assessment.rst', 'r')
-&gt;&gt;&gt; f = open ('armstrong.py', 'r+')</pre>
-<p id="ch4strings_dicts_1e">The third argument to the <span class="strong"><strong>open()</strong></span> method is the <span class="emphasis"><em>buffering</em></span> argument. This takes
-a boolean value, <span class="emphasis"><em>True</em></span> or <span class="emphasis"><em>1</em></span> indicates that buffering has to be enabled on the file,
-that is the file is loaded on to the main memory and the changes made to the file are
-not immediately written to the disk. If the <span class="emphasis"><em>buffering</em></span> argument is <span class="emphasis"><em>0</em></span> or <span class="emphasis"><em>False</em></span> the
-changes are directly written on to the disk immediately.</p>
-</div>
-<div class="section" title="4.2.Reading and Writing files">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034646"></a>4.2.Reading and Writing files</h3></div></div></div>
-<div class="section" title="4.2.1.write()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3034655"></a>4.2.1.<span class="strong"><strong>write()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_1f"><span class="strong"><strong>write()</strong></span>, evidently, is used to write data onto a file. It takes the data to
-be written as the argument. The data can be a string, an integer, a float or any
-other datatype. In order to be able to write data onto a file, the file has to
-be opened in one of <span class="strong"><strong>w</strong></span>, <span class="strong"><strong>a</strong></span> or <span class="strong"><strong>+</strong></span> modes.</p>
-</div>
-<div class="section" title="4.2.2.read()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3034694"></a>4.2.2.<span class="strong"><strong>read()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_20"><span class="strong"><strong>read()</strong></span> is used to read data from a file. It takes the number of bytes of data
-to be read as the argument. If nothing is specified by default it reads the entire
-contents from the current position to the end of file.</p>
-<p id="ch4strings_dicts_21">Let us look at a few examples:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; f = open ('randomtextfile', 'w')
-&gt;&gt;&gt; f.write('Hello all, this is PythonFreak. This is a random text file.')
-&gt;&gt;&gt; f = open ('../randomtextfile', 'r')
-&gt;&gt;&gt; f = open ('../randomtextfile', 'r')
-&gt;&gt;&gt; f.read(5)
-'Hello'
-&gt;&gt;&gt; f.read()
-' all, this is PythonFreak. This is a random text file.'
-&gt;&gt;&gt; f.close()</pre>
-</div>
-<div class="section" title="4.2.3.readline()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3034729"></a>4.2.3.<span class="strong"><strong>readline()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_22"><span class="strong"><strong>readline()</strong></span> is used to read a file line by line. <span class="strong"><strong>readline()</strong></span> reads a line
-of a file at a time. When an argument is passed to <span class="strong"><strong>readline()</strong></span> it reads that
-many bytes from the current line.</p>
-<p id="ch4strings_dicts_23">One other method to read a file line by line is using the <span class="strong"><strong>read()</strong></span> and the
-<span class="strong"><strong>for</strong></span> construct. Let us look at this block of code as an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; f = open('../randomtextfile', 'r')
-&gt;&gt;&gt; for line in f:
-...     print line
-...
-Hello all!
-
-This is PythonFreak on the second line.
-
-This is a random text file on line 3</pre>
-</div>
-<div class="section" title="4.2.4.close()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3034788"></a>4.2.4.<span class="strong"><strong>close()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_24">One must always close all the files that have been opened. Although, files opened
-will be closed automatically when the program ends. When files opened in read mode
-are not closed it might lead to uselessly locked sometimes. In case of files
-opened in the write mode it is more important to close the files. This is because,
-Python maybe using the file in the buffering mode and when the file is not closed
-the buffer maybe lost completely and the changes made to the file are lost forever.</p>
-</div>
-</div>
-</div>
-<div class="section" title="5.Dictionaries">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id3034811"></a>5.Dictionaries</h2></div></div></div>
-<p id="ch4strings_dicts_25">A dictionary in general, are designed to be able to look up meanings of words.
-Similarly, the Python dictionaries are also designed to look up for a specific
-key and retrieve the corresponding value. Dictionaries are data structures that
-provide key-value mappings. Dictionaries are similar to lists except that instead
-of the values having integer indexes, dictionaries have keys or strings as indexes.
-Let us look at an example of how to define dictionaries.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; dct = { 'Sachin': 'Tendulkar', 'Rahul': 'Dravid', 'Anil': 'Kumble'}</pre>
-<p id="ch4strings_dicts_26">The dictionary consists of pairs of strings, which are called <span class="emphasis"><em>keys</em></span> and their
-corresponding <span class="emphasis"><em>values</em></span> separated by <span class="emphasis"><em>:</em></span> and each of these <span class="emphasis"><em>key-value</em></span> pairs are
-comma(',') separated and the entire structure wrapped in a pair curly braces <span class="emphasis"><em>{}</em></span>.</p>
-<pre class="programlisting">
-Note: The data inside a dictionary is not ordered. The order in which you enter
-the key-value pairs is not the order in which they are stored in the dictionary.
-Python has an internal storage mechanism for that which is out of the purview
-of this document.</pre>
-<div class="section" title="5.1.dict()">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034868"></a>5.1.<span class="strong"><strong>dict()</strong></span>
-</h3></div></div></div>
-<p id="ch4strings_dicts_27">The <span class="strong"><strong>dict()</strong></span> function is used to create dictionaries from other mappings or other
-dictionaries. Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; diction = dict(mat = 133, avg = 52.53)</pre>
-<p id="ch4strings_dicts_28"><span class="strong"><strong>String Formatting with Dictionaries:</strong></span></p>
-<p id="ch4strings_dicts_29">String formatting was discussed in the previous section and it was mentioned that
-dictionaries can also be used for formatting more than one value. This section
-focuses on the formatting of strings using dictionaries. String formatting using
-dictionaries is more appealing than doing the same with tuples. Here the <span class="emphasis"><em>keyword</em></span>
-can be used as a place holder and the <span class="emphasis"><em>value</em></span> corresponding to it is replaced in
-the formatted string. Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; player = { 'Name':'Rahul Dravid', 'Matches':133, 'Avg':52.53, '100s':26 }
-&gt;&gt;&gt; strng = '%(Name)s has played %(Matches)d with an average of %(Avg).2f and has %(100s)d hundreds to his name.'
-&gt;&gt;&gt; print strng % player
-Rahul Dravid has played 133 with an average of 52.53 and has 26 hundreds to his name.</pre>
-</div>
-<div class="section" title="5.2.Dictionary Methods">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id3034932"></a>5.2.Dictionary Methods</h3></div></div></div>
-<div class="section" title="5.2.1.clear()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3034940"></a>5.2.1.<span class="strong"><strong>clear()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_2a">The <span class="strong"><strong>clear()</strong></span> method removes all the existing <span class="emphasis"><em>key-value</em></span> pairs from a dictionary.
-It returns <span class="emphasis"><em>None</em></span> or rather does not return anything. It is a method that changes
-the object. It has to be noted here that dictionaries are not immutable. Let us
-look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; dct
-{'Anil': 'Kumble', 'Sachin': 'Tendulkar', 'Rahul': 'Dravid'}
-&gt;&gt;&gt; dct.clear()
-&gt;&gt;&gt; dct
-{}</pre>
-</div>
-<div class="section" title="5.2.2.copy()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3034976"></a>5.2.2.<span class="strong"><strong>copy()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_2b">The <span class="strong"><strong>copy()</strong></span> returns a copy of a given dictionary. Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; dct = {'Anil': 'Kumble', 'Sachin': 'Tendulkar', 'Rahul': 'Dravid'}
-&gt;&gt;&gt; dctcopy = dct.copy()
-&gt;&gt;&gt; dctcopy
-{'Anil': 'Kumble', 'Sachin': 'Tendulkar', 'Rahul': 'Dravid'}</pre>
-</div>
-<div class="section" title="5.2.3.get()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3035006"></a>5.2.3.<span class="strong"><strong>get()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_2c"><span class="strong"><strong>get()</strong></span> returns the <span class="emphasis"><em>value</em></span> for the <span class="emphasis"><em>key</em></span> passed as the argument and if the
-<span class="emphasis"><em>key</em></span> does not exist in the dictionary, it returns <span class="emphasis"><em>None</em></span>. Let us look at an
-example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; print dctcopy.get('Saurav')
-None
-&gt;&gt;&gt; print dctcopy.get('Anil')
-Kumble</pre>
-</div>
-<div class="section" title="5.2.4.has_key()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3035044"></a>5.2.4.<span class="strong"><strong>has_key()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_2d">This method returns <span class="emphasis"><em>True</em></span> if the given <span class="emphasis"><em>key</em></span> is in the dictionary, else it returns
-<span class="emphasis"><em>False</em></span>.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; dctcopy.has_key('Saurav')
-False
-&gt;&gt;&gt; dctcopy.has_key('Sachin')
-True</pre>
-</div>
-<div class="section" title="5.2.5.pop()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3035074"></a>5.2.5.<span class="strong"><strong>pop()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_2e">This method is used to retrieve the <span class="emphasis"><em>value</em></span> of a given <span class="emphasis"><em>key</em></span> and subsequently
-remove the <span class="emphasis"><em>key-value</em></span> pair from the dictionary. Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; print dctcopy.pop('Sachin')
-Tendulkar
-&gt;&gt;&gt; dctcopy
-{'Anil': 'Kumble', 'Rahul': 'Dravid'}</pre>
-</div>
-<div class="section" title="5.2.6.popitem()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3035108"></a>5.2.6.<span class="strong"><strong>popitem()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_2f">This method randomly pops a <span class="emphasis"><em>key-value</em></span> pair from a dictionary and returns it.
-The <span class="emphasis"><em>key-value</em></span> pair returned is removed from the dictionary. Let us look at an
-example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; print dctcopy.popitem()
-('Anil', 'Kumble')
-&gt;&gt;&gt; dctcopy
-{'Rahul': 'Dravid'}
-
-Note that the item chosen is completely random since dictionaries are unordered
-as mentioned earlier.</pre>
-</div>
-<div class="section" title="5.2.7.update()">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id3035144"></a>5.2.7.<span class="strong"><strong>update()</strong></span>
-</h4></div></div></div>
-<p id="ch4strings_dicts_30">The <span class="strong"><strong>update()</strong></span> method updates the contents of one dictionary with the contents
-of another dictionary. For items with existing <span class="emphasis"><em>keys</em></span> their <span class="emphasis"><em>values</em></span> are updated,
-and the rest of the items are added. Let us look at an example.</p>
-<pre class="programlisting">
-&gt;&gt;&gt; dctcopy.update(dct)
-&gt;&gt;&gt; dct
-{'Anil': 'Kumble', 'Sachin': 'Tendulkar', 'Rahul': 'Dravid'}
-&gt;&gt;&gt; dctcopy
-{'Anil': 'Kumble', 'Sachin': 'Tendulkar', 'Rahul': 'Dravid'}</pre>
-</div>
-</div>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch5func.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. func</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch5func">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2803272">Functional Approach</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2854310">1. Function scope</a></span></dt>
-<dt><span class="section"><a href="#id2854368">2. Default Arguments</a></span></dt>
-<dt><span class="section"><a href="#id2854408">3. Keyword Arguments</a></span></dt>
-<dt><span class="section"><a href="#id2854524">4. Parameter Packing and Unpacking</a></span></dt>
-<dt><span class="section"><a href="#id2854624">5. Nested Functions and Scopes</a></span></dt>
-<dt><span class="section"><a href="#id2854673">6. map, reduce and filter functions</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2854863">6.1. List Comprehensions</a></span></dt></dl></dd>
-</dl></dd>
-</dl>
-</div>
-<div class="article" title="Functional Approach">
-<div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2803272"></a>Functional Approach</h2></div></div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2854310">1. Function scope</a></span></dt>
-<dt><span class="section"><a href="#id2854368">2. Default Arguments</a></span></dt>
-<dt><span class="section"><a href="#id2854408">3. Keyword Arguments</a></span></dt>
-<dt><span class="section"><a href="#id2854524">4. Parameter Packing and Unpacking</a></span></dt>
-<dt><span class="section"><a href="#id2854624">5. Nested Functions and Scopes</a></span></dt>
-<dt><span class="section"><a href="#id2854673">6. map, reduce and filter functions</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2854863">6.1. List Comprehensions</a></span></dt></dl></dd>
-</dl>
-</div>
-<p id="ch5func_1"><span class="emphasis"><em>Functions</em></span> allow us to enclose a set of statements and call the function again
-and again instead of repeating the group of statements everytime. Functions also
-allow us to isolate a piece of code from all the other code and provides the
-convenience of not polluting the global variables.</p>
-<p id="ch5func_2"><span class="emphasis"><em>Function</em></span> in python is defined with the keyword <span class="strong"><strong>def</strong></span> followed by the name
-of the function, in turn followed by a pair of parenthesis which encloses the
-list of parameters to the function. The definition line ends with a ':'. The
-definition line is followed by the body of the function intended by one block.
-The <span class="emphasis"><em>Function</em></span> must return a value:</p>
-<pre class="programlisting">
-def factorial(n):
-  fact = 1
-  for i in range(2, n):
-    fact *= i
-
-  return fact</pre>
-<p id="ch5func_3">The code snippet above defines a function with the name factorial, takes the
-number for which the factorial must be computed, computes the factorial and
-returns the value.</p>
-<p id="ch5func_4">A <span class="emphasis"><em>Function</em></span> once defined can be used or called anywhere else in the program. We
-call a fucntion with its name followed by a pair of parenthesis which encloses
-the arguments to the function.</p>
-<p id="ch5func_5">The value that function returns can be assigned to a variable. Let's call the
-above function and store the factorial in a variable:</p>
-<pre class="programlisting">
-fact5 = factorial(5)</pre>
-<p id="ch5func_6">The value of fact5 will now be 120, which is the factorial of 5. Note that we
-passed 5 as the argument to the function.</p>
-<p id="ch5func_7">It may be necessary to document what the function does, for each of the function
-to help the person who reads our code to understand it better. In order to do
-this Python allows the first line of the function body to be a string. This
-string is called as <span class="emphasis"><em>Documentation String</em></span> or <span class="emphasis"><em>docstring</em></span>. <span class="emphasis"><em>docstrings</em></span> prove
-to be very handy since there are number of tools which can pull out all the
-docstrings from Python functions and generate the documentation automatically
-from it. <span class="emphasis"><em>docstrings</em></span> for functions can be written as follows:</p>
-<pre class="programlisting">
-def factorial(n):
-  'Returns the factorial for the number n.'
-  fact = 1
-  for i in range(2, n):
-    fact *= i
-
-  return fact</pre>
-<p id="ch5func_8">An important point to note at this point is that, a function can return any
-Python value or a Python object, which also includes a <span class="emphasis"><em>Tuple</em></span>. A <span class="emphasis"><em>Tuple</em></span> is
-just a collection of values and those values themselves can be of any other
-valid Python datatypes, including <span class="emphasis"><em>Lists</em></span>, <span class="emphasis"><em>Tuples</em></span>, <span class="emphasis"><em>Dictionaries</em></span> among other
-things. So effectively, if a function can return a tuple, it can return any
-number of values through a tuple</p>
-<p id="ch5func_9">Let us write a small function to swap two values:</p>
-<pre class="programlisting">
-def swap(a, b):
-  return b, a
-
-c, d = swap(a, b)</pre>
-<div class="section" title="1.Function scope">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2854310"></a>1.Function scope</h2></div></div></div>
-<p id="ch5func_a">The variables used inside the function are confined to the function's scope
-and doesn't pollute the variables of the same name outside the scope of the
-function. Also the arguments passed to the function are passed by-value if
-it is of basic Python data type:</p>
-<pre class="programlisting">
-def cant_change(n):
-  n = 10
-
-n = 5
-cant_change(n)</pre>
-<p id="ch5func_b">Upon running this code, what do you think would have happened to value of n
-which was assigned 5 before the function call? If you have already tried out
-that snippet on the interpreter you already know that the value of n is not
-changed. This is true of any immutable types of Python like <span class="emphasis"><em>Numbers</em></span>, <span class="emphasis"><em>Strings</em></span>
-and <span class="emphasis"><em>Tuples</em></span>. But when you pass mutable objects like <span class="emphasis"><em>Lists</em></span> and <span class="emphasis"><em>Dictionaries</em></span>
-the values are manipulated even outside the function:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; def can_change(n):
-...   n[1] = James
-...
-
-&gt;&gt;&gt; name = ['Mr.', 'Steve', 'Gosling']
-&gt;&gt;&gt; can_change(name)
-&gt;&gt;&gt; name
-['Mr.', 'James', 'Gosling']</pre>
-<p id="ch5func_c">If nothing is returned by the function explicitly, Python takes care to return
-None when the funnction is called.</p>
-</div>
-<div class="section" title="2.Default Arguments">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2854368"></a>2.Default Arguments</h2></div></div></div>
-<p id="ch5func_d">There may be situations where we need to allow the functions to take the
-arguments optionally. Python allows us to define function this way by providing
-a facility called <span class="emphasis"><em>Default Arguments</em></span>. For example, we need to write a function
-that returns a list of fibonacci numbers. Since our function cannot generate an
-infinite list of fibonacci numbers, we need to specify the number of elements
-that the fibonacci sequence must contain. Suppose, additionally, we want to the
-function to return 10 numbers in the sequence if no option is specified we can
-define the function as follows:</p>
-<pre class="programlisting">
-def fib(n=10):
-  fib_list = [0, 1]
-  for i in range(n - 2):
-    next = fib_list[-2] + fib_list[-1]
-    fib_list.append(next)
-  return fib_list</pre>
-<p id="ch5func_e">When we call this function, we can optionally specify the value for the
-parameter n, during the call as an argument. Calling with no argument and
-argument with n=5 returns the following fibonacci sequences:</p>
-<pre class="programlisting">
-fib()
-[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
-fib(5)
-[0, 1, 1, 2, 3]</pre>
-</div>
-<div class="section" title="3.Keyword Arguments">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2854408"></a>3.Keyword Arguments</h2></div></div></div>
-<p id="ch5func_f">When a function takes a large number of arguments, it may be difficult to
-remember the order of the parameters in the function definition or it may
-be necessary to pass values to only certain parameters since others take
-the default value. In either of these cases, Python provides the facility
-of passing arguments by specifying the name of the parameter as defined in
-the function definition. This is known as <span class="emphasis"><em>Keyword Arguments</em></span>.</p>
-<p id="ch5func_10">In a function call, <span class="emphasis"><em>Keyword arguments</em></span> can be used for each argument, in the
-following fashion:</p>
-<pre class="programlisting">
-argument_name=argument_value
-Also denoted as: keyword=argument
-
-def wish(name='World', greetings='Hello'):
-  print "%s, %s!" % (greetings, name)</pre>
-<p id="ch5func_11">This function can be called in one of the following ways. It is important to
-note that no restriction is imposed in the order in which <span class="emphasis"><em>Keyword arguments</em></span>
-can be specified. Also note, that we have combined <span class="emphasis"><em>Keyword arguments</em></span> with
-<span class="emphasis"><em>Default arguments</em></span> in this example, however it is not necessary:</p>
-<pre class="programlisting">
-wish(name='Guido', greetings='Hey')
-wish(greetings='Hey', name='Guido')</pre>
-<p id="ch5func_12">Calling functions by specifying arguments in the order of parameters specified
-in the function definition is called as <span class="emphasis"><em>Positional arguments</em></span>, as opposed to
-<span class="emphasis"><em>Keyword arguments</em></span>. It is possible to use both <span class="emphasis"><em>Positional arguments</em></span> and
-<span class="emphasis"><em>Keyword arguments</em></span> in a single function call. But Python doesn't allow us to
-bungle up both of them. The arguments to the function, in the call, must always
-start with <span class="emphasis"><em>Positional arguments</em></span> which is in turn followed by <span class="emphasis"><em>Keyword
-arguments</em></span>:</p>
-<pre class="programlisting">
-def my_func(x, y, z, u, v, w):
-  # initialize variables.
-  ...
-  # do some stuff
-  ...
-  # return the value</pre>
-<p id="ch5func_13">It is valid to call the above functions in the following ways:</p>
-<pre class="programlisting">
-my_func(10, 20, 30, u=1.0, v=2.0, w=3.0)
-my_func(10, 20, 30, 1.0, 2.0, w=3.0)
-my_func(10, 20, z=30, u=1.0, v=2.0, w=3.0)
-my_func(x=10, y=20, z=30, u=1.0, v=2.0, w=3.0)</pre>
-<p id="ch5func_14">Following lists some of the invalid calls:</p>
-<pre class="programlisting">
-my_func(10, 20, z=30, 1.0, 2.0, 3.0)
-my_func(x=10, 20, z=30, 1.0, 2.0, 3.0)
-my_func(x=10, y=20, z=30, u=1.0, v=2.0, 3.0)</pre>
-</div>
-<div class="section" title="4.Parameter Packing and Unpacking">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2854524"></a>4.Parameter Packing and Unpacking</h2></div></div></div>
-<p id="ch5func_15">The positional arguments passed to a function can be collected in a tuple
-parameter and keyword arguments can be collected in a dictionary. Since keyword
-arguments must always be the last set of arguments passed to a function, the
-keyword dictionary parameter must be the last parameter. The function definition
-must include a list explicit parameters, followed by tuple paramter collecting
-parameter, whose name is preceded by a <span class="strong"><strong>*</strong></span>, for collecting positional
-parameters, in turn followed by the dictionary collecting parameter, whose name
-is preceded by a <span class="strong"><strong>**</strong></span></p>
-<pre class="programlisting">
-def print_report(title, *args, **name):
-  """Structure of *args*
-  (age, email-id)
-  Structure of *name*
-  {
-      'first': First Name
-      'middle': Middle Name
-      'last': Last Name
-  }
-  """
-
-  print "Title: %s" % (title)
-  print "Full name: %(first)s %(middle)s %(last)s" % name
-  print "Age: %d nEmail-ID: %s" % args</pre>
-<p id="ch5func_16">The above function can be called as. Note, the order of keyword parameters can
-be interchanged:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; print_report('Employee Report', 29, 'johny@example.com', first='Johny',
-                 last='Charles', middle='Douglas')
-Title: Employee Report
-Full name: Johny Douglas Charles
-Age: 29
-Email-ID: johny@example.com</pre>
-<p id="ch5func_17">The reverse of this can also be achieved by using a very identical syntax while
-calling the function. A tuple or a dictionary can be passed as arguments in
-place of a list of <span class="emphasis"><em>Positional arguments</em></span> or <span class="emphasis"><em>Keyword arguments</em></span> respectively
-using <span class="strong"><strong>*</strong></span> or <span class="strong"><strong>**</strong></span></p>
-<pre class="programlisting">
-def print_report(title, age, email, first, middle, last):
-  print "Title: %s" % (title)
-  print "Full name: %s %s %s" % (first, middle, last)
-  print "Age: %d nEmail-ID: %s" % (age, email)
-
-&gt;&gt;&gt; args = (29, 'johny@example.com')
-&gt;&gt;&gt; name = {
-        'first': 'Johny',
-        'middle': 'Charles',
-        'last': 'Douglas'
-        }
-&gt;&gt;&gt; print_report('Employee Report', *args, **name)
-Title: Employee Report
-Full name: Johny Charles Douglas
-Age: 29
-Email-ID: johny@example.com</pre>
-</div>
-<div class="section" title="5.Nested Functions and Scopes">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2854624"></a>5.Nested Functions and Scopes</h2></div></div></div>
-<p id="ch5func_18">Python allows nesting one function inside another. This style of programming
-turns out to be extremely flexible and powerful features when we use <span class="emphasis"><em>Python
-decorators</em></span>. We will not talk about decorators is beyond the scope of this
-course. If you are interested in knowing more about <span class="emphasis"><em>decorator programming</em></span> in
-Python you are suggested to read:</p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://avinashv.net/2008/04/python-decorators-syntactic-sugar/</div>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://personalpages.tds.net/~kent37/kk/00001.html</div>
-<p id="ch5func_19">However, the following is an example for nested functions in Python:</p>
-<pre class="programlisting">
-def outer():
-  print "Outer..."
-  def inner():
-    print "Inner..."
-  print "Outer..."
-  inner()
-
-&gt;&gt;&gt; outer()</pre>
-</div>
-<div class="section" title="6.map, reduce and filter functions">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2854673"></a>6.map, reduce and filter functions</h2></div></div></div>
-<p id="ch5func_1a">Python provides several built-in functions for convenience. The <span class="strong"><strong>map()</strong></span>,
-<span class="strong"><strong>reduce()</strong></span> and <span class="strong"><strong>filter()</strong></span> functions prove to be very useful with sequences like
-<span class="emphasis"><em>Lists</em></span>.</p>
-<p id="ch5func_1b">The <span class="strong"><strong>map</strong></span> (<span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>sequence</em></span>) function takes two arguments: <span class="emphasis"><em>function</em></span>
-and a <span class="emphasis"><em>sequence</em></span> argument. The <span class="emphasis"><em>function</em></span> argument must be the name of the
-function which in turn takes a single argument, the individual element of the
-<span class="emphasis"><em>sequence</em></span>. The <span class="strong"><strong>map</strong></span> function calls <span class="emphasis"><em>function(item)</em></span>, for each item in the
-sequence and returns a list of values, where each value is the value returned
-by each call to <span class="emphasis"><em>function(item)</em></span>. <span class="strong"><strong>map()</strong></span> function allows to pass more than
-one sequence. In this case, the first argument, <span class="emphasis"><em>function</em></span> must take as many
-arguments as the number of sequences passed. This function is called with each
-corresponding element in the each of the sequences, or <span class="strong"><strong>None</strong></span> if one of the
-sequence is exhausted:</p>
-<pre class="programlisting">
-def square(x):
-  return x*x
-
-&gt;&gt;&gt; map(square, [1, 2, 3, 4])
-[1, 4, 9, 16]
-
-def mul(x, y):
-  return x*y
-
-&gt;&gt;&gt; map(mul, [1, 2, 3, 4], [6, 7, 8, 9])</pre>
-<p id="ch5func_1c">The <span class="strong"><strong>filter</strong></span> (<span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>sequence</em></span>) function takes two arguments, similar to
-the <span class="strong"><strong>map()</strong></span> function. The <span class="strong"><strong>filter</strong></span> function calls <span class="emphasis"><em>function(item)</em></span>, for each
-item in the sequence and returns all the elements in the sequence for which
-<span class="emphasis"><em>function(item)</em></span> returned True:</p>
-<pre class="programlisting">
-def even(x):
-  if x % 2:
-    return True
-  else:
-    return False
-
-&gt;&gt;&gt; filter(even, range(1, 10))
-[1, 3, 5, 7, 9]</pre>
-<p id="ch5func_1d">The <span class="strong"><strong>reduce</strong></span> (<span class="emphasis"><em>function</em></span>, <span class="emphasis"><em>sequence</em></span>) function takes two arguments, similar to
-<span class="strong"><strong>map</strong></span> function, however multiple sequences are not allowed. The <span class="strong"><strong>reduce</strong></span>
-function calls <span class="emphasis"><em>function</em></span> with first two consecutive elements in the sequence,
-obtains the result, calls <span class="emphasis"><em>function</em></span> with the result and the subsequent element
-in the sequence and so on until the end of the list and returns the final result:</p>
-<pre class="programlisting">
-def mul(x, y):
-  return x*y
-
-&gt;&gt;&gt; reduce(mul, [1, 2, 3, 4])
-24</pre>
-<div class="section" title="6.1.List Comprehensions">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2854863"></a>6.1.List Comprehensions</h3></div></div></div>
-<p id="ch5func_1e">List Comprehension is a convenvience utility provided by Python. It is a
-syntatic sugar to create <span class="emphasis"><em>Lists</em></span>. Using <span class="emphasis"><em>List Comprehensions</em></span> one can create
-<span class="emphasis"><em>Lists</em></span> from other type of sequential data structures or other <span class="emphasis"><em>Lists</em></span> itself.
-The syntax of <span class="emphasis"><em>List Comprehensions</em></span> consists of a square brackets to indicate
-the result is a <span class="emphasis"><em>List</em></span> within which we include at least one <span class="strong"><strong>for</strong></span> clause and
-multiple <span class="strong"><strong>if</strong></span> clauses. It will be more clear with an example:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; num = [1, 2, 3]
-&gt;&gt;&gt; sq = [x*x for x in num]
-&gt;&gt;&gt; sq
-[1, 4, 9]
-&gt;&gt;&gt; all_num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
-&gt;&gt;&gt; even = [x for x in all_num if x%2 == 0]</pre>
-<p id="ch5func_1f">The syntax used here is very clear from the way it is written. It can be
-translated into english as, "for each element x in the list all_num,
-if remainder of x divided by 2 is 0, add x to the list."</p>
-</div>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch6oop.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. oop</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch6oop">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl><dt><span class="article"><a href="#id2745996">Classes and Objects</a></span></dt></dl>
-</div>
-<div class="article" title="Classes and Objects">
-<div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2745996"></a>Classes and Objects</h2></div></div>
-<hr />
-</div>
-<p id="ch6oop_1">In the previous sections we learnt about functions which provide certain level
-of abstraction to our code by holding the code which performs one or more
-specific functionalities. We were able to use this function as many times as we
-wanted. In addition to functions, Python also higher level of abstractions
-through <span class="emphasis"><em>Classes</em></span> and <span class="emphasis"><em>Objects</em></span>. <span class="emphasis"><em>Objects</em></span> can be loosely defined as a
-collection of a set of data items and a set of methods. The data items can be
-any valid Python variable or any Python object. Functions enclosed within a class
-are called as <span class="emphasis"><em>methods</em></span>. If you are thinking if methods are functions why is there
-a distinction between the two? The answer to this will be given as we walk through
-the concepts of <span class="emphasis"><em>Classes</em></span> and <span class="emphasis"><em>Objects</em></span>. <span class="emphasis"><em>Classes</em></span> contain the definition for the
-<span class="emphasis"><em>Objects</em></span>. <span class="emphasis"><em>Objects</em></span> are instances of <span class="emphasis"><em>Classes</em></span>.</p>
-<p id="ch6oop_2">A class is defined using the keyword <span class="strong"><strong>class</strong></span> followed by the class name, in
-turn followed by a semicolon. The statements that a <span class="emphasis"><em>Class</em></span> encloses are written
-in a new block, i.e on the next indentation level:</p>
-<pre class="programlisting">
-class Employee:
-  def setName(self, name):
-    self.name = name
-
-  def getName(self):
-    return self.name</pre>
-<p id="ch6oop_3">In the above example, we defined a class with the name Employee. We also defined
-two methods, setName and getName for this class. It is important to note the
-differences between the normal Python functions and class methods defined above.
-Each method of the class must take the same instance of the class(object) from
-which it was called as the first argument. It is conventionally given the name,
-<span class="emphasis"><em>self</em></span>. Note that <span class="emphasis"><em>self</em></span> is only a convention. You can use any other name, but
-the first argument to the method will always be the same object of the class
-from which the method was called. The data memebers that belong to the class are
-called as <span class="emphasis"><em>class attributes</em></span>. <span class="emphasis"><em>Class attributes</em></span> are preceded by the object of
-the class and a dot. In the above example, <span class="emphasis"><em>name</em></span> is a class attribute since it
-is preceded by the <span class="emphasis"><em>self</em></span> object. <span class="emphasis"><em>Class attributes</em></span> can be accessed from
-anywhere within the class.</p>
-<p id="ch6oop_4">We can create objects of a class outside the class definition by using the same
-syntax we use to call a function with no parameters. We can assign this object
-to a variable:</p>
-<pre class="programlisting">
-emp = Employee()</pre>
-<p id="ch6oop_5">In the above example, we create an object named <span class="emphasis"><em>emp</em></span> of the class <span class="emphasis"><em>Employee</em></span>.
-All the attributes and methods of the class can be accessed by the object of the
-class using the standard notation <span class="emphasis"><em>object.attribute</em></span> or <span class="emphasis"><em>object.method()</em></span>.
-Although the first parameter of a class method is the self object, it must not
-be passed as an argument when calling the method. The <span class="emphasis"><em>self</em></span> object is implicitly
-passed to the method by the Python interpreter. All other arguments passing rules
-like default arguments, keyword arguments, argument packing and unpacking follow
-the same rules as those for ordinary Python functions:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; emp.setName('John')
-&gt;&gt;&gt; name = emp.getName()
-&gt;&gt;&gt; print name
-John
-&gt;&gt;&gt; print emp.name
-John</pre>
-<p id="ch6oop_6">If we at all try to access a class attribute before assigning a value to it, i.e
-before creating it, Python raises the same error as it would raise for the
-accessing undefined variable:</p>
-<pre class="programlisting">
-&gt;&gt;&gt; emp = Employee()
-&gt;&gt;&gt; emp.name
-Traceback (most recent call last):
-  File "class.py", line 10, in &lt;module&gt;
-    print e.name
-AttributeError: Employee instance has no attribute 'name'</pre>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch7interim_assessment.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. interim_assessment</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch7interim_assessment">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl><dt><span class="article"><a href="#id2937348">Interim Assessment</a></span></dt></dl>
-</div>
-<div class="article" title="Interim Assessment"><div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2937348"></a>Interim Assessment</h2></div></div>
-<hr />
-</div></div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch8ult_module_plan.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. ult_module_plan</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch8ult_module_plan">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2644006">Using Linux Tools</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2454051">1. Module Objectives</a></span></dt>
-<dt><span class="section"><a href="#id2694962">2. Suggested Reading</a></span></dt>
-</dl></dd>
-</dl>
-</div>
-<div class="article" title="Using Linux Tools">
-<div class="titlepage">
-<div><div><h2 class="title">
-<a name="id2644006"></a>Using Linux Tools</h2></div></div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2454051">1. Module Objectives</a></span></dt>
-<dt><span class="section"><a href="#id2694962">2. Suggested Reading</a></span></dt>
-</dl>
-</div>
-<div class="section" title="1.Module Objectives">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2454051"></a>1.Module Objectives</h2></div></div></div>
-<p id="ch8ult_module_plan_1">After successfully completing this module a participant will be able to:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch8ult_module_plan_2">Understand the design philosophy of *nix                     {U}</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch8ult_module_plan_3">Use Linux as their day-to-day operating system                {Ap}</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch8ult_module_plan_4">Use the text processing tools such as 'grep', 'tr'            {Ap}</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch8ult_module_plan_5">Write and execute (bash) shell scripts                        {Ap}</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch8ult_module_plan_6">Use a text editor comfortably                                 {Ap}</p></li>
-</ul></div>
-</div>
-<div class="section" title="2.Suggested Reading">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2694962"></a>2.Suggested Reading</h2></div></div></div>
-<div class="orderedlist"><ol class="orderedlist" type="1">
-<li class="listitem"><p id="ch8ult_module_plan_7">"In the beginning..." by Neal Stephenson</p></li>
-<li class="listitem"><p id="ch8ult_module_plan_8">"The Unix Programming Environment" by Kerninghan and Pike</p></li>
-</ol></div>
-<p id="ch8ult_module_plan_9"><span class="strong"><strong>Initial Session Plan</strong></span></p>
-<p id="ch8ult_module_plan_a">Session</p>
-<p id="ch8ult_module_plan_b">Topic</p>
-<p id="ch8ult_module_plan_c">Duration</p>
-<p id="ch8ult_module_plan_d">1</p>
-<p id="ch8ult_module_plan_e">Introduction to the Course</p>
-<p id="ch8ult_module_plan_f">Historical background and
-implications. Why Unix?</p>
-<p id="ch8ult_module_plan_10">Getting startedlogging in; <span class="emphasis"><em>ls,
-date, who, cd, mkdir</em></span></p>
-<p id="ch8ult_module_plan_11">Getting help: <span class="emphasis"><em>apropos, man,
-info</em></span></p>
-<p id="ch8ult_module_plan_12">Basic file handling: <span class="emphasis"><em>cp, mv,
-rm</em></span></p>
-<p id="ch8ult_module_plan_13">First session buffer</p>
-<p id="ch8ult_module_plan_14">5 mt</p>
-<p id="ch8ult_module_plan_15">10 mts</p>
-<p id="ch8ult_module_plan_16">10 mts</p>
-<p id="ch8ult_module_plan_17">10 mts</p>
-<p id="ch8ult_module_plan_18">10 mts</p>
-<p id="ch8ult_module_plan_19">5 mts</p>
-<p id="ch8ult_module_plan_1a">2</p>
-<p id="ch8ult_module_plan_1b">Command line arguments</p>
-<p id="ch8ult_module_plan_1c">Basic text processing: <span class="emphasis"><em>head,
-tail, cut, paste</em></span></p>
-<p id="ch8ult_module_plan_1d">Shell meta characters</p>
-<p id="ch8ult_module_plan_1e">Looking at files: <span class="emphasis"><em>cat, less</em></span></p>
-<p id="ch8ult_module_plan_1f">Directory structure: <span class="emphasis"><em>man hier,
-ls -l</em></span></p>
-<p id="ch8ult_module_plan_20">Permissions and ownership,
-<span class="emphasis"><em>chmod, chown</em></span></p>
-<p id="ch8ult_module_plan_21">5 mts</p>
-<p id="ch8ult_module_plan_22">15 mts</p>
-<p id="ch8ult_module_plan_23">10 mts</p>
-<p id="ch8ult_module_plan_24">5 mts</p>
-<p id="ch8ult_module_plan_25">5 mts</p>
-<p id="ch8ult_module_plan_26">10 mts</p>
-<p id="ch8ult_module_plan_27">3</p>
-<p id="ch8ult_module_plan_28">Redirection and Piping</p>
-<p id="ch8ult_module_plan_29">More text processing:<span class="emphasis"><em>grep, tr</em></span></p>
-<p id="ch8ult_module_plan_2a">Elementary regex: . ? * ^ $ [ ]</p>
-<p id="ch8ult_module_plan_2b">One liners: show lines n to m,
-show directories</p>
-<p id="ch8ult_module_plan_2c">10 mts</p>
-<p id="ch8ult_module_plan_2d">10 mts</p>
-<p id="ch8ult_module_plan_2e">15 mts</p>
-<p id="ch8ult_module_plan_2f">15 mts</p>
-<p id="ch8ult_module_plan_30">4</p>
-<p id="ch8ult_module_plan_31">More text processing: <span class="emphasis"><em>join,
-sprt, uniq</em></span></p>
-<p id="ch8ult_module_plan_32">Generating a word frequency list</p>
-<p id="ch8ult_module_plan_33">Basic editing and editors : vim,
-scite</p>
-<p id="ch8ult_module_plan_34">Personalising your environment:
-<span class="emphasis"><em>.bashrc, .vimrc</em></span></p>
-<p id="ch8ult_module_plan_35">Subshells and <span class="emphasis"><em>source~</em></span></p>
-<p id="ch8ult_module_plan_36">10 mts</p>
-<p id="ch8ult_module_plan_37">10 mts</p>
-<p id="ch8ult_module_plan_38">10 mts</p>
-<p id="ch8ult_module_plan_39">10 mts</p>
-<p id="ch8ult_module_plan_3a">10 mts</p>
-<p id="ch8ult_module_plan_3b">5</p>
-<p id="ch8ult_module_plan_3c">More tools: <span class="emphasis"><em>tar, zip, diff,
-cmp, comm</em></span></p>
-<p id="ch8ult_module_plan_3d">Environment variables, <span class="emphasis"><em>set</em></span></p>
-<p id="ch8ult_module_plan_3e">Writing simple shell scripts</p>
-<p id="ch8ult_module_plan_3f">25 mts</p>
-<p id="ch8ult_module_plan_40">10 mts</p>
-<p id="ch8ult_module_plan_41">15 mts</p>
-<p id="ch8ult_module_plan_42">6</p>
-<p id="ch8ult_module_plan_43">Control structures and
-operators in bash</p>
-<p id="ch8ult_module_plan_44">Writing shell scripts</p>
-<p id="ch8ult_module_plan_45">20 mts</p>
-<p id="ch8ult_module_plan_46">30 mts</p>
-<p id="ch8ult_module_plan_47">7</p>
-<p id="ch8ult_module_plan_48">Functions in bash scripts</p>
-<p id="ch8ult_module_plan_49">Assessment Test</p>
-<p id="ch8ult_module_plan_4a">20 mts</p>
-<p id="ch8ult_module_plan_4b">30 mts</p>
-<p id="ch8ult_module_plan_4c"><span class="emphasis"><em>total session time = 350 mts</em></span></p>
-<p id="ch8ult_module_plan_4d"><span class="emphasis"><em>buffer time = 10 mts</em></span></p>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/ch9Using_Linux_Tools.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1428 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. Using_Linux_Tools</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch9Using_Linux_Tools">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2915025"></a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2725116">1. Introducing Linux</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2722785">1.1. Historical Background</a></span></dt>
-<dt><span class="section"><a href="#id2966078">1.2. Design and Implications</a></span></dt>
-<dt><span class="section"><a href="#id2966362">1.3. Reasons for Using Linux</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2966502">2. Getting Started</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2966511">2.1. Logging in, activating the user interface and logging out</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2966791">3. Basic Commands</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2966799">3.1. ls</a></span></dt>
-<dt><span class="section"><a href="#id2966962">3.2. date</a></span></dt>
-<dt><span class="section"><a href="#id2967022">3.3. cd</a></span></dt>
-<dt><span class="section"><a href="#id2967124">3.4. who</a></span></dt>
-<dt><span class="section"><a href="#id2967207">3.5. mkdir</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967374">4. Getting Help</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2967383">4.1. apropos and whatis</a></span></dt>
-<dt><span class="section"><a href="#id2967478">4.2. man</a></span></dt>
-<dt><span class="section"><a href="#id2967672">4.3. info</a></span></dt>
-<dt><span class="section"><a href="#id2967759">4.4. --help</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967812">5. Basic file handling</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2967820">5.1. cp</a></span></dt>
-<dt><span class="section"><a href="#id2968133">5.2. mv</a></span></dt>
-<dt><span class="section"><a href="#id2968265">5.3. rm</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2968433">6. Command Line Arguments</a></span></dt>
-<dt><span class="section"><a href="#id2968526">7. Basic Text Processing</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2968535">7.1. head</a></span></dt>
-<dt><span class="section"><a href="#id2968622">7.2. tail</a></span></dt>
-<dt><span class="section"><a href="#id2968750">7.3. cut</a></span></dt>
-<dt><span class="section"><a href="#id2968837">7.4. paste</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2968957">8. Shell Meta Characters</a></span></dt>
-<dt><span class="section"><a href="#id2969064">9. Looking At Files</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2969072">9.1. cat</a></span></dt>
-<dt><span class="section"><a href="#id2969260">9.2. more</a></span></dt>
-<dt><span class="section"><a href="#id2969371">9.3. less</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2969612">10. Directory Structure</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2969877">10.1. man hier</a></span></dt>
-<dt><span class="section"><a href="#id2969893">10.2. ls -l</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2969916">11. Permissions and Ownership</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2969925">11.1. chmod</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2965366">12. Redirection and Piping</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2970852">12.1. Redirecting standard input and standard output</a></span></dt>
-<dt><span class="section"><a href="#id2970920">12.2. Piping</a></span></dt>
-<dt><span class="section"><a href="#id2970982">12.3. Redirecting to and from the standard file handles</a></span></dt>
-<dt><span class="section"><a href="#id2971176">12.4. Chained pipelines</a></span></dt>
-<dt><span class="section"><a href="#id2971209">12.5. Redirect to multiple outputs</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2971240">13. More Text Processing</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2971248">13.1. grep</a></span></dt>
-<dt><span class="section"><a href="#id2971438">13.2. tr</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2971585">14. Elementary Regex</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2971786">14.1. Lazy quantification</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2971862">15. One Liners</a></span></dt>
-</dl></dd>
-</dl>
-</div>
-<div class="article">
-<div class="titlepage">
-<div>
-<div><h2 class="title" id="id2915025"></h2></div>
-<div><h2 class="title" id="id2915025"></h2></div>
-</div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2725116">1. Introducing Linux</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2722785">1.1. Historical Background</a></span></dt>
-<dt><span class="section"><a href="#id2966078">1.2. Design and Implications</a></span></dt>
-<dt><span class="section"><a href="#id2966362">1.3. Reasons for Using Linux</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2966502">2. Getting Started</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2966511">2.1. Logging in, activating the user interface and logging out</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2966791">3. Basic Commands</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2966799">3.1. ls</a></span></dt>
-<dt><span class="section"><a href="#id2966962">3.2. date</a></span></dt>
-<dt><span class="section"><a href="#id2967022">3.3. cd</a></span></dt>
-<dt><span class="section"><a href="#id2967124">3.4. who</a></span></dt>
-<dt><span class="section"><a href="#id2967207">3.5. mkdir</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967374">4. Getting Help</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2967383">4.1. apropos and whatis</a></span></dt>
-<dt><span class="section"><a href="#id2967478">4.2. man</a></span></dt>
-<dt><span class="section"><a href="#id2967672">4.3. info</a></span></dt>
-<dt><span class="section"><a href="#id2967759">4.4. --help</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2967812">5. Basic file handling</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2967820">5.1. cp</a></span></dt>
-<dt><span class="section"><a href="#id2968133">5.2. mv</a></span></dt>
-<dt><span class="section"><a href="#id2968265">5.3. rm</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2968433">6. Command Line Arguments</a></span></dt>
-<dt><span class="section"><a href="#id2968526">7. Basic Text Processing</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2968535">7.1. head</a></span></dt>
-<dt><span class="section"><a href="#id2968622">7.2. tail</a></span></dt>
-<dt><span class="section"><a href="#id2968750">7.3. cut</a></span></dt>
-<dt><span class="section"><a href="#id2968837">7.4. paste</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2968957">8. Shell Meta Characters</a></span></dt>
-<dt><span class="section"><a href="#id2969064">9. Looking At Files</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2969072">9.1. cat</a></span></dt>
-<dt><span class="section"><a href="#id2969260">9.2. more</a></span></dt>
-<dt><span class="section"><a href="#id2969371">9.3. less</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2969612">10. Directory Structure</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2969877">10.1. man hier</a></span></dt>
-<dt><span class="section"><a href="#id2969893">10.2. ls -l</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2969916">11. Permissions and Ownership</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2969925">11.1. chmod</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2965366">12. Redirection and Piping</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2970852">12.1. Redirecting standard input and standard output</a></span></dt>
-<dt><span class="section"><a href="#id2970920">12.2. Piping</a></span></dt>
-<dt><span class="section"><a href="#id2970982">12.3. Redirecting to and from the standard file handles</a></span></dt>
-<dt><span class="section"><a href="#id2971176">12.4. Chained pipelines</a></span></dt>
-<dt><span class="section"><a href="#id2971209">12.5. Redirect to multiple outputs</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2971240">13. More Text Processing</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2971248">13.1. grep</a></span></dt>
-<dt><span class="section"><a href="#id2971438">13.2. tr</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2971585">14. Elementary Regex</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2971786">14.1. Lazy quantification</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2971862">15. One Liners</a></span></dt>
-</dl>
-</div>
-<div class="section" title="1.Introducing Linux">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2725116"></a>1.Introducing Linux</h2></div></div></div>
-<p id="ch9Using_Linux_Tools_1">(Attribution : A significant chunk of the content under this section is based on data from Wikipedia and the Linux Documentation Project)</p>
-<p id="ch9Using_Linux_Tools_2">Linux (usually pronounced lnks') is a generic term referring to Unix-like computer operating systems based on the Linux kernel, where a kernel is the intermediate layer between the hardware and the applications. The kernel is, on an abstract level, the core of (most) operating systems, that manages the various system resources. The development of the Linux OS is considered the basis for Free and Open Source Software (FOSS) collaboration since typically the underlying source code can be used, modified freely, and redistributed by anyone under the terms of the GNU (a recursive acronym for "GNU's Not Unix!") Global Public License (GPL) and other free software licences. This freedom to access and reuse various components of a system, is one of the primary reasons for the popularity of Linux.</p>
-<p id="ch9Using_Linux_Tools_3">Linux is installed on a variety of computer hardware, that include mobile phones, embedded devices and supercomputers, but is infamous for its use in servers.</p>
-<p id="ch9Using_Linux_Tools_4">The name "Linux"  comes from the Linux kernel, originally written in 1991 by Linus Torvalds. The rest of the system usually comprises components such as the Apache HTTP Server, the X Window System, the GNOME and KDE desktop environments, and utilities and libraries from the GNU Project (announced in 1983 by Richard Stallman). Commonly-used applications with desktop Linux systems include the Mozilla Firefox web-browser and the OpenOffice.org office application suite. The GNU contribution is the basis for the Free Software Foundation's preferred name GNU/Linux. The kernel's mascot is a penguin named "Tux". Mozilla Firefox and OpenOffice.org are open-source projects which can be run on most Operating Systems, including proprietary ones.</p>
-<div class="section" title="1.1.Historical Background">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2722785"></a>1.1.Historical Background</h3></div></div></div>
-<div class="section" title="1.1.1.Events leading to the creation">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2913514"></a>1.1.1.Events leading to the creation</h4></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_5">The Unix operating system was developed in the 1960s and released for public use in 1970. Its accessibility and portability caused it to be widely adopted, copied and modified by academic institutions and businesses. Its design became influential to authors of other systems. Other free operating systems include the Berkeley Software Distribution (BSD), developed at the University of California at Berkeley, and MINIX which was released by Andrew S. Tanenbaum. The development and adoption of BSD and MINIX were limited due to various reasons, and this lack of a widely-adopted and free kernel triggered Linus Torvalds into starting his project.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_6">In 1983, Richard Stallman started the GNU project with the goal of creating a free UNIX-like operating system. As part of this work, he wrote the GNU General Public License (GPL). By the early 1990s there was almost enough available software to create a full operating system. However, the GNU kernel, called Hurd, failed to attract enough attention from developers leaving GNU incomplete.</p></li>
-</ul></div>
-</div>
-<div class="section" title="1.1.2.The Creation of Linux">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966043"></a>1.1.2.The Creation of Linux</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_7">In 1991, Linus Torvalds began a project at the University of Helsinki that later became the Linux kernel. It was initially a terminal (command-line) emulator, which Torvalds used to access the large UNIX servers of the university. He wrote the program targeting just the hardware he was using and independent of an operating system because he wanted to use the functions of his computer with an 80386 processor. Development was done on Minix using the GNU C compiler. This application is still the main choice for compiling Linux today (although the code can be built with other compilers, such as the Intel C Compiler).</p>
-<p id="ch9Using_Linux_Tools_8">Torvalds continues to direct the development of the kernel. Stallman heads the Free Software Foundation, which in turn supports the GNU components. Finally, individuals and corporations develop third-party non-GNU components, which constitute a vast body of work and including kernel modules, and user applications and libraries. Linux vendors and communities combine and distribute the kernel, GNU components, and non-GNU components, with additional package management software in the form of Linux distributions.</p>
-</div>
-</div>
-<div class="section" title="1.2.Design and Implications">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2966078"></a>1.2.Design and Implications</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_9">A Linux-based system is a modular Unix-like operating system, deriving much of its basic design from principles established in Unix earlier. Such a system uses a monolithic kernel, called the Linux kernel, which handles process control, networking, and peripheral and file system access. Device drivers are integrated directly with the kernel. Separate projects that interface with the kernel provide much of the system's higher-level functionality. The GNU userland is an important part of most Linux-based systems, providing the most common implementation of the C library, a popular shell, and many of the common Unix tools which carry out many basic operating system tasks. The graphical user interface (or GUI) used by most Linux systems is based on the "X Window System".</p>
-<div class="section" title="1.2.1.User Interface">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966102"></a>1.2.1.User Interface</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_a">Users can control a Linux-based system through a command line interface (or CLI), a graphical user interface (or GUI), or through controls attached to the associated hardware (this is common for embedded systems). For desktop systems, the default mode is usually the GUI. On desktop machines, "KDE", "GNOME" and "Xfce" are the most popular user interfaces,though a variety of additional user interfaces exist. Most popular user interfaces run on top of the "X Window System" (or X), which enables a graphical application running on one machine to be displayed and controlled from another in a network.</p>
-<p id="ch9Using_Linux_Tools_b">A Linux system also provides a CLI of some sort through a shell, which is the traditional way of interacting with a Unix system. A Linux distribution specialized for servers may use the CLI as its only interface. A headless system (system run without even a monitor) can be controlled by the command line via a remote-control protocol such as SSH or telnet. The CLI is particularly suited for automation of repetitive or delayed tasks, and provides very simple inter-process communication. A graphical terminal emulator program is often used to access the CLI from a Linux desktop.</p>
-</div>
-<div class="section" title="1.2.2.Development">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966156"></a>1.2.2.Development</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_c">The primary difference between Linux and many other popular contemporary operating systems is that the Linux kernel and other components are free and open source software. Linux is not the only such operating system, although it is by far the most widely used. Some free and open source software licenses are based on the principle of "copyleft", a kind of reciprocity: any work derived from a copyleft piece of software must also be copyleft itself. The most common free software license, the GNU GPL, is a form of copyleft, and is used for the Linux kernel and many of the components from the GNU project.</p>
-<p id="ch9Using_Linux_Tools_d">Linux based distributions are intended by developers for interoperability with other operating systems and established computing standards. Linux systems adhere to POSIX, SUS, ISO and ANSI standards where possible, although to date only one Linux distribution has been POSIX.1 certified, Linux-FT.Free software projects, although developed in a collaborative fashion, are often produced independently of each other. The fact that the software licenses explicitly permit redistribution, however, provides a basis for larger scale projects that collect the software produced by stand-alone projects and make it available all at once in the form of a Linux distribution.</p>
-<p id="ch9Using_Linux_Tools_e">A Linux distribution, commonly called a "distro", is a project that manages a remote collection of system software and application software packages available for download and installation through a network connection. This allows the user to adapt the operating system to his/her specific needs. Distributions are maintained by individuals, loose-knit teams, volunteer organizations, and commercial entities. A distribution can be installed using a CD that contains distribution-specific software for initial system installation and configuration. A package manager such as Synaptic or YAST allows later package upgrades and installations. A distribution is responsible for the default configuration of the installed Linux kernel, general system security, and more generally integration of the different software packages into a coherent whole.</p>
-</div>
-<div class="section" title="1.2.3.Community">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966223"></a>1.2.3.Community</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_f">A distribution is largely driven by its developer and user communities. Some vendors develop and fund their distributions on a volunteer basis. Examples include Debian and the Debian-based, Ubuntu. Others maintain a community version of their commercial distributions, as Red Hat does with Fedora.</p>
-<p id="ch9Using_Linux_Tools_10">In many cities and regions, local associations known as Linux Users Groups (LUGs) seek to promote their preferred distribution and by extension free software. They hold meetings and provide free demonstrations, training, technical support, and operating system installation to new users. Many Internet communities also provide support to Linux users and developers. Most distributions and free software / open source projects have IRC (Internet Relay Chat) chatrooms or newsgroups. Online forums are another means for support. Linux distributions host mailing lists; commonly there will be a specific topic such as usage or development for a given list. All these can be found simply by running an appropriate search on Google.</p>
-<p id="ch9Using_Linux_Tools_11">Although Linux distributions are generally available without charge, several large corporations sell, support, and contribute to the development of the components of the system and of free software. These include Dell, IBM, HP, Oracle, Sun Microsystems, Novell, Nokia. A number of corporations, notably Red Hat, have built their entire business around Linux distributions.</p>
-</div>
-<div class="section" title="1.2.4.Can I make a profit out of running a business involving Linux?">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966268"></a>1.2.4.Can I make a profit out of running a business involving Linux?</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_12">The answer is, "Yes!". The free software licenses, on which the various software packages of a distribution built on the Linux kernel are based, explicitly accommodate and encourage commercialization; the relationship between a Linux distribution as a whole and individual vendors may be seen as symbiotic. One common business model of commercial suppliers is charging for support, especially for business users. A number of companies also offer a specialized business version of their distribution, which adds proprietary support packages and tools to administer higher numbers of installations or to simplify administrative tasks. Another business model is to give away the software in order to sell hardware. Examples of corporations that are extensively (and sometimes exclusively) open-source and Linux-powered , with successful revenue generation models involving these, are Google, SUN, Mozilla, etc.</p>
-</div>
-<div class="section" title="1.2.5.Programming on Linux">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966314"></a>1.2.5.Programming on Linux</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_13">Most Linux distributions support dozens of programming languages. The most common collection of utilities for building both Linux applications and operating system programs is found within the GNU toolchain, which includes the GNU Compiler Collection (GCC) and the GNU build system. Amongst others, GCC provides compilers for Ada, C, C++, Java, and Fortran. The Linux kernel itself is written to be compiled with GCC. Proprietary compilers for Linux include the Intel C++ Compiler, Sun Studio, and IBM XL C/C++ Compiler.</p>
-<p id="ch9Using_Linux_Tools_14">Most distributions also include support for PHP, Perl, Ruby, Python and other dynamic languages. Examples of languages that are less common, but still supported, are C# via the Mono project, sponsored by Novell, and Scheme. A number of Java Virtual Machines and development kits run on Linux, including the original Sun Microsystems JVM (HotSpot), and IBM's J2SE RE, as well as many open-source projects like Kaffe.</p>
-<p id="ch9Using_Linux_Tools_15">The two main frameworks for developing graphical applications are those of GNOME and KDE. These projects are based on the GTK+ and Qt widget toolkits, respectively, which can also be used independently of the larger framework. Both support a wide variety of languages. There are a number of Integrated Development Environments (IDEs) available including Anjuta, Code::Blocks, Eclipse, KDevelop, Lazarus, MonoDevelop, NetBeans, and Omnis Studio while the long-established editors Vim and Emacs remain popular.</p>
-</div>
-</div>
-<div class="section" title="1.3.Reasons for Using Linux">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2966362"></a>1.3.Reasons for Using Linux</h3></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*"><li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_16">Linux is free:</p></li></ul></div>
-<p id="ch9Using_Linux_Tools_17">As in "free beer". Linux can be downloaded in its entirety from the Internet completely for free. No registration fees, no costs per user, free updates, and freely available source code in case you want to change the behavior of your system.
-Most of all, Linux is free as in "free speech":
-The license commonly used is the GNU Public License (GPL). The license says that anybody who may want to do so, has the right to change Linux and eventually to redistribute a changed version, on the one condition that the code is still available after redistribution. In practice, you are free to grab a kernel image and sell the new code, as long as your customers can still have a copy of that code.</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*"><li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_18">Linux is portable to any hardware platform:</p></li></ul></div>
-<p id="ch9Using_Linux_Tools_19">A vendor, who wants to sell a new type of computer and who does not know what kind of OS his/her new machine will run, can take a Linux kernel and make it work on his/her hardware, because documentation related to this activity is freely available.</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*"><li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_1a">Linux was made to keep on running:</p></li></ul></div>
-<p id="ch9Using_Linux_Tools_1b">As with UNIX, a Linux system expects to run without rebooting all the time. That is why a lot of tasks are being executed at night or scheduled automatically for other times, resulting in higher availability during busier periods and a more balanced use of the hardware. This property allows for Linux to be applicable to environments where people do not have the time or the possibility to control their systems constantly.</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*"><li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_1c">Linux is secure and versatile:</p></li></ul></div>
-<p id="ch9Using_Linux_Tools_1d">The security model used in Linux is based on the UNIX idea of security, which is known to be robust and of proven quality. But Linux is not only safe from attacks from the Internet: it will adapt equally to other situations, utilizing the same high standards for security.</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*"><li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_1e">Linux is scalable:</p></li></ul></div>
-<p id="ch9Using_Linux_Tools_1f">From a Palmtop with 2 MB of memory to a petabyte storage cluster with hundreds of nodes: add or remove the appropriate packages and Linux fits all. One does not need a supercomputer anymore,because you can use Linux to do big things using the building blocks provided with the system. If one wants to do little things, such as making an operating system for an embedded processor or just recycling your old 486, Linux will do that as well.</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*"><li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_20">The Linux OS and Linux applications have very short debugtimes:</p></li></ul></div>
-<p id="ch9Using_Linux_Tools_21">Because Linux has been developed and tested by thousands of people, both errors and people to fix them are found very quickly. It often happens that there are only a couple of hours between discovery and fixing of a bug.</p>
-</div>
-</div>
-<div class="section" title="2.Getting Started">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2966502"></a>2.Getting Started</h2></div></div></div>
-<div class="section" title="2.1.Logging in, activating the user interface and logging out">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2966511"></a>2.1.Logging in, activating the user interface and logging out</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_22">In order to work on a Linux system directly, one needs to provide a user name and password. You always need to authenticate to the system. Most PCbased Linux systems have two basic modes for a system to run in: either quick and clean in text console mode,which includes with mouse, multitasking and multiuser features, or in graphical console mode, which looks better but eats more system resources.</p>
-<div class="section" title="2.1.1.Graphical Mode">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966541"></a>2.1.1.Graphical Mode</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_23">This is the default nowadays on most desktop computers. You know you will be connecting to the system using graphical mode when you are first asked for your user name, and then to type your password.</p>
-<p id="ch9Using_Linux_Tools_24">To log in, make sure the mouse pointer is in the login window, provide your user name and password to the system and click <span class="emphasis"><em>OK</em></span> or press <span class="emphasis"><em>Enter</em></span>.
-It is generally considered a bad idea to connect (graphically) using the root user name, the system adminstrator's account, since the use of graphics includes running a lot of extra programs, in root's case with a lot of extra permissions. To keep all risks as low as possible, use a normal user account to connect graphically. But there are enough risks to keep this in mind as a general advice, for all use of the root account: only log in as root when extra privileges are required.</p>
-<p id="ch9Using_Linux_Tools_25">After entering your user name/password combination, it can take a little while before the graphical environment is started, depending on the CPU speed of your computer, on the software you use and on your personal settings.</p>
-<p id="ch9Using_Linux_Tools_26">To continue, you will need to open a <span class="emphasis"><em>terminal window</em></span> or <span class="emphasis"><em>xterm</em></span> for short (X being the name for the underlying software supporting the graphical environment). This program can be found in the <span class="emphasis"><em>Applications&gt;Utilities-&gt;System Tools</em></span> or <span class="emphasis"><em>Internet menu</em></span>, depending on what window manager you are using. There might be icons that you can use as a shortcut to get an <span class="emphasis"><em>xterm</em></span> window as well, and clicking the right mouse button on the desktop background will usually present you with a menu containing a terminal window application.</p>
-<p id="ch9Using_Linux_Tools_27">While browsing the menus, you will notice that a lot of things can be done without entering commands via the keyboard. For most users, the good old pointnclick method of dealing with the computer will do. But for those who want to enter the "heart" of the system, a tool stronger than a mouse will be required to handle the various tasks. This tool is the shell, and when in graphical mode, we activate our shell by opening a terminal window.</p>
-<p id="ch9Using_Linux_Tools_28">A terminal window should always show a command prompt when you open one. This terminal shows a standard prompt, which displays the user's login name, and the current working directory, represented by the twiddle (~)</p>
-<p id="ch9Using_Linux_Tools_29">Another common form for a prompt is this one:
-[</p>
-<div class="reference">
-<div class="titlepage"><hr /></div>user@host</div>
-<p> dir]</p>
-<p id="ch9Using_Linux_Tools_2a">In the above example, <span class="emphasis"><em>user</em></span> will be your login name, <span class="emphasis"><em>hosts</em></span> the name of the machine you are working on, and <span class="emphasis"><em>dir</em></span> an indication of your current location in the file system. Prompts can display all kinds of information, but they are not part of the commands you are giving to your system. To disconnect from the system in graphical mode, you need to close all terminal windows and other applications. After that, hit the <span class="emphasis"><em>logout</em></span> icon or find <span class="emphasis"><em>Log Out</em></span> in the menu. Closing everything is not really necessary, and the system can do this for you, but session management might put all currently open applications back on your screen when you connect again, which takes longer and is not always the desired effect. However, this behavior is configurable.</p>
-<p id="ch9Using_Linux_Tools_2b">When you see the login screen again, asking to enter user name and password, logout was successful.</p>
-</div>
-<div class="section" title="2.1.2.Text Mode">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2966701"></a>2.1.2.Text Mode</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_2c">One is in text mode when the whole screen is black, showing (in most cases white) characters. A text mode login screen typically shows some information about the machine you are working on, the name of the machine and a prompt waiting for you to log in.</p>
-<p id="ch9Using_Linux_Tools_2d">The login is different from a graphical login, in that you have to hit the <span class="emphasis"><em>Enter</em></span> key after providing your user name, because there are no buttons on the screen that you can click with the mouse. Then you should type your password, followed by another <span class="emphasis"><em>Enter</em></span>. You will not see any indication that you are entering something, not even an asterisk, and you won't see the cursor move. But this is normal on Linux and is done for security
-reasons.</p>
-<p id="ch9Using_Linux_Tools_2e">When the system has accepted you as a valid user, you may get some more information, called the <span class="emphasis"><em>message of the day</em></span>, which can be anything. Additionally, it is popular on UNIX systems to display a fortune cookie, which contains some general wise or unwise (this is up to you) thoughts. After that, you will be given a shell, indicated with the same prompt that you would get in graphical mode.</p>
-<p id="ch9Using_Linux_Tools_2f">Also in text mode: log in as root only to do setup and configuration that absolutely requires administrator privileges, such as adding users, installing software packages, and performing network and other system configuration. Once you are finished, immediately leave the special account and resume your work as a nonprivileged user.</p>
-<p id="ch9Using_Linux_Tools_30">Logging out is done by entering the <span class="emphasis"><em>logout</em></span> command, followed by Enter. You are successfully disconnected from the system when you see the login screen again.Don't poweroff the computer after logging out. It is not meant to be shut off without application of the proper procedures for halting the system. Powering it off without going through the halting process might cause severe damage!</p>
-</div>
-</div>
-</div>
-<div class="section" title="3.Basic Commands">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2966791"></a>3.Basic Commands</h2></div></div></div>
-<div class="section" title="3.1.ls">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2966799"></a>3.1.ls</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_31">When invoked without any arguments, <span class="emphasis"><em>ls</em></span> lists the files in the current working directory. A directory that is not the current working directory can be specified and ls will list the files there. The user also may specify any list of files and directories. In this case, all files and all contents of specified directories will be listed. The name <span class="emphasis"><em>ls</em></span> is derived from <span class="emphasis"><em>list segments</em></span> which was used in earlier systems.</p>
-<p id="ch9Using_Linux_Tools_32">Files whose names start with "." are not listed, unless the <span class="emphasis"><em>-a</em></span> flag is specified or the files are specified explicitly.</p>
-<p id="ch9Using_Linux_Tools_33">Without options, <span class="emphasis"><em>ls</em></span> displays files in a bare format. This bare format however makes it difficult to establish the type, permissions, and size of the files. The most common options to reveal this information or change the list of files are:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_34"><span class="emphasis"><em>-l</em></span> long format, displaying Unix file types, permissions, number of hard links, owner, group, size, date, and filename</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_35"><span class="emphasis"><em>-F</em></span> appends a character revealing the nature of a file, for example, * for an executable, or / for a directory. Regular files have no suffix.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_36"><span class="emphasis"><em>-a</em></span> lists all files in the given directory, including those whose names start with "." (which are hidden files in Unix). By default, these files are excluded from the list.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_37"><span class="emphasis"><em>-R</em></span> recursively lists subdirectories. The command ls -R / would therefore list all files.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_38"><span class="emphasis"><em>-d</em></span> shows information about a symbolic link or directory, rather than about the link's target or listing the contents of a directory.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_39"><span class="emphasis"><em>-t</em></span> sort the list of files by modification time.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_3a"><span class="emphasis"><em>-h</em></span> print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.)</p></li>
-</ul></div>
-<p id="ch9Using_Linux_Tools_3b">In some environments, providing the option <span class="emphasis"><em>--color</em></span> (for GNU ls) or <span class="emphasis"><em>-G</em></span> (FreeBSD ls) causes ls to highlight different types of files with different colors, instead of with characters as <span class="emphasis"><em>-F</em></span> would. To determine what color to use for a file, GNU <span class="emphasis"><em>ls</em></span> checks the Unix file type, the file permissions, and the file extension, while FreeBSD <span class="emphasis"><em>ls</em></span> checks only the Unix file type and file permissions.:</p>
-<pre class="programlisting">
-$ ls
-jeeves.rst psmith.html blandings.html
-$ ls -l
-drwxr--r--   1 plum  editors   4096  jeeves
--rw-r--r--   1 plum  editors  30405  psmith
--r-xr-xr-x   1 plum  plum      8460  blandings</pre>
-<p id="ch9Using_Linux_Tools_3c">Here "$" actually is the beginning of the prompt. This is typical in most Unix-based systems.</p>
-</div>
-<div class="section" title="3.2.date">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2966962"></a>3.2.date</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_3d">The Unix date command displays the time and date. The super-user can use it to set the system clock.</p>
-<p id="ch9Using_Linux_Tools_3e">With no options, the date command displays the current date and time, including the abbreviated day name, abbreviated month name, day of the month, the time separated by colons, the timezone name, and the year. For example:</p>
-<pre class="programlisting">
-$date
-Tue Sep  8 12:01:45 IST 2009</pre>
-<p id="ch9Using_Linux_Tools_3f">On some systems to set the current date and time to September 8, 2004 01:22 you type:</p>
-<pre class="programlisting">
-$date --set="20040908 01:22"</pre>
-<p id="ch9Using_Linux_Tools_40">In order to view the various options for the <span class="emphasis"><em>date</em></span> command, type:</p>
-<pre class="programlisting">
-$man date</pre>
-<p id="ch9Using_Linux_Tools_41">This will take you to the "Manual" page comprising of all the details on the <span class="emphasis"><em>date</em></span> command. You can return to the terminal from the "man" page by pressing the <span class="emphasis"><em>Esc</em></span> key in the keyboard and typing ":q" in that order.</p>
-</div>
-<div class="section" title="3.3.cd">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967022"></a>3.3.cd</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_42">This stands for "change directory". When one wants to go up to the parent directory, bypassing the tree of directories one has entered,  cd .. can be used.</p>
-<p id="ch9Using_Linux_Tools_43">One dot '.' represents the current directory while two dots '..' represent the parent directory.</p>
-<p id="ch9Using_Linux_Tools_44"> cd - will return you to the previous directory (a bit like an undo).</p>
-<p id="ch9Using_Linux_Tools_45">You can also use cd absolute path or cd relative path (see below):</p>
-<p id="ch9Using_Linux_Tools_46">Absolute paths:</p>
-<p id="ch9Using_Linux_Tools_47">An  absolute path is easily recognised from the leading forward slash, /. The / means that you start at the top level directory and continue down.</p>
-<p id="ch9Using_Linux_Tools_48">For example to get to /boot/grub you would type:</p>
-<pre class="programlisting">
-$cd /boot/grub</pre>
-<p id="ch9Using_Linux_Tools_49">This is an absolute path because you start at the top of the hierarchy and go downwards from there (it doesn't matter where in the filesystem you were when you typed the command).</p>
-<p id="ch9Using_Linux_Tools_4a">Relative paths:</p>
-<p id="ch9Using_Linux_Tools_4b">A  relative path doesn't have a preceding slash. Use a relative path when you start from a directory below the top level directory structure. This is dependent on where you are in the filesystem.</p>
-<p id="ch9Using_Linux_Tools_4c">For example if you are in root's home directory and want to get to /root/music, you type:</p>
-<pre class="programlisting">
-$ cd music</pre>
-<p id="ch9Using_Linux_Tools_4d">Please note that there is no / using the above cd command. Using a / would cause this to be an absolute path, working from the top of the hierarchy downward.</p>
-</div>
-<div class="section" title="3.4.who">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967124"></a>3.4.who</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_4e">The standard Unix command <span class="emphasis"><em>who</em></span> displays a list of users who are currently logged into a computer.</p>
-<p id="ch9Using_Linux_Tools_4f">The <span class="emphasis"><em>who</em></span> command is related to the command <span class="emphasis"><em>w</em></span>, which provides the same information but also displays additional data and statistics.:</p>
-<pre class="programlisting">
-$who
-beeblebrox tty7         2009-09-08 10:50 (:0)
-beeblebrox pts/0        2009-09-08 11:25 (:0.0)
-dumbledore pts/1        2009-09-08 18:11 (potter.xyz.in)
-beeblebrox pts/2        2009-09-08 18:53 (:0.0)</pre>
-<p id="ch9Using_Linux_Tools_50">The command can be invoked with the arguments <span class="emphasis"><em>am i</em></span> or <span class="emphasis"><em>am I</em></span> (so it is invoked as <span class="emphasis"><em>who am i</em></span> or * who am I*), showing information about the current terminal only (see the <span class="emphasis"><em>-m</em></span> option below, of which this invocation is equivalent).</p>
-<p id="ch9Using_Linux_Tools_51">In order to find out the various options that can be appended to the <span class="emphasis"><em>who</em></span> command, check the <span class="emphasis"><em>man</em></span> page by typing out the following in the terminal:</p>
-<pre class="programlisting">
-$man who</pre>
-<p id="ch9Using_Linux_Tools_52">This will take you to the "Manual" page containing details about the <span class="emphasis"><em>who</em></span> command</p>
-</div>
-<div class="section" title="3.5.mkdir">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967207"></a>3.5.mkdir</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_53">This command is used to make a new directory. Normal usage is as straightforward as follows:</p>
-<pre class="programlisting">
-$mkdir name_of_directory</pre>
-<p id="ch9Using_Linux_Tools_54">Where <span class="emphasis"><em>name_of_directory</em></span> is the name of the directory one wants to create. When typed as above (ie. normal usage), the new directory would be created within the current directory. On Unix, multiple directories can be specified, and <span class="emphasis"><em>mkdir</em></span> will try to create all of them.</p>
-<div class="section" title="3.5.1.Options">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2967239"></a>3.5.1.Options</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_55">On Unix-like operating systems, <span class="emphasis"><em>mkdir</em></span> takes options. Three of the most common options are:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_56"><span class="emphasis"><em>-p</em></span>: will also create all directories leading up to the given directory that do not exist already. If the given directory already exists, ignore the error.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_57"><span class="emphasis"><em>-v</em></span>: display each directory that mkdir creates. Most often used with -p.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_58"><span class="emphasis"><em>-m</em></span>: specify the octal permissions of directories created by mkdir.</p></li>
-</ul></div>
-<p id="ch9Using_Linux_Tools_59"><span class="emphasis"><em>-p</em></span> is most often used when using mkdir to build up complex directory hierarchies, in case a necessary directory is missing or already there. -m is commonly used to lock down temporary directories used by shell scripts.</p>
-</div>
-<div class="section" title="3.5.2.Examples">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2967298"></a>3.5.2.Examples</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_5a">An example of <span class="emphasis"><em>-p</em></span> in action is:</p>
-<pre class="programlisting">
-$mkdir -p /tmp/a/b/c</pre>
-<p id="ch9Using_Linux_Tools_5b">If <span class="emphasis"><em>/tmp/a</em></span> exists but <span class="emphasis"><em>/tmp/a/b</em></span> does not, mkdir will create <span class="emphasis"><em>/tmp/a/b</em></span> before creating <span class="emphasis"><em>/tmp/a/b/c</em></span>.</p>
-<p id="ch9Using_Linux_Tools_5c">And an even more powerful command, creating a full tree at once (this however is a Shell extension, nothing mkdir does itself):</p>
-<pre class="programlisting">
-$mkdir -p tmpdir/{trunk/sources/{includes,docs},branches,tags}</pre>
-<p id="ch9Using_Linux_Tools_5d">This will create:</p>tmpdir  - branches<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_5e">tag</p></li>
-<li class="listitem" style="list-style-type: *">trunk - sources - includes<div class="itemizedlist"><ul class="itemizedlist" type="*"><li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_5f">docs</p></li></ul></div>
-</li>
-</ul></div>
-</div>
-</div>
-</div>
-<div class="section" title="4.Getting Help">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967374"></a>4.Getting Help</h2></div></div></div>
-<div class="section" title="4.1.apropos and whatis">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967383"></a>4.1.apropos and whatis</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_60">This is a command to search the manual pages files in Unix and Unix-like operating systems.</p>
-<pre class="programlisting">
-$ apropos grep
-egrep       egrep (1)       Search a file for a pattern using full regular expressions
-fgrep       fgrep (1)       Search a file for a fixed-character string
-fmlgrep     fmlgrep (1)     Search a file for a pattern
-grep        grep (1)        Search a file for a pattern
-gzgrep      gzgrep (1)      Search a possibly compressed file for a regular expression
-nisgrep     nismatch (1)    Utilities for searching NIS+ tables
-pgrep       pgrep (1)       Find or signal a process by name or other attribute
-zgrep       zgrep (1)       Search a possibly compressed file for a regular expression
-...</pre>
-<p id="ch9Using_Linux_Tools_61">In this example, the user uses <span class="emphasis"><em>apropos</em></span> to search for the string "grep", and apropos returns the indicated <span class="emphasis"><em>man</em></span> pages that include the term "grep".</p>
-<p id="ch9Using_Linux_Tools_62">A short index of explanations for commands is available using the <span class="emphasis"><em>whatis</em></span> command, like in the examples below:</p>
-<pre class="programlisting">
-$whatis ls
-ls (1)           - list directory contents</pre>
-<p id="ch9Using_Linux_Tools_63">This displays short information about a command, and the first section in the collection of man pages that contains an appropriate page.</p>
-<p id="ch9Using_Linux_Tools_64">If you don't know where to get started and which man page to read, <span class="emphasis"><em>apropos</em></span> gives more information. Say that you do not know how to start a browser, then you could enter the following command:</p>
-<pre class="programlisting">
-$apropos browser
-gmusicbrowser (1)    - Jukebox for large collections of audio files
-infobrowser (1)      - read Info documents
-libsmbclient (7)     - An extension library for browsers and that               can be used...
-opera (1)            - a standards-compliant graphical Web browser
-sensible-browser (1) - sensible editing, paging, and web browsing
-smbtree (1)          - A text based smb network browser
-tvtk_doc (1)         - A GUI based TVTK documentation search browser.
-viewres (1)          - graphical class browser for Xt
-w3m (1)              - a text based Web browser and pager
-www-browser (1)      - a text based Web browser and pager
-...</pre>
-</div>
-<div class="section" title="4.2.man">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967478"></a>4.2.man</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_65">Man pages (short for "manual pages") are the extensive documentation that comes preinstalled with almost all substantial Unix and Unix-like operating systems. The Unix command used to display them is <span class="emphasis"><em>man</em></span>. Each page is a self-contained document.</p>
-<p id="ch9Using_Linux_Tools_66">To read a manual page for a Unix command, one can use:</p>
-<pre class="programlisting">
-$ man &lt;command_name&gt;</pre>
-<p id="ch9Using_Linux_Tools_67">at a shell prompt; for example, "man ftp". In order to simplify navigation through the output, <span class="emphasis"><em>man</em></span> generally uses the less terminal pager.</p>
-<p id="ch9Using_Linux_Tools_68">Pages are traditionally referred to using the notation "name(section)"; for example, ftp(1). The same page name may appear in more than one section of the manual, this can occur when the names of system calls, user commands, or macro packages coincide. Two examples are <span class="emphasis"><em>man(1)</em></span> and <span class="emphasis"><em>man(7)</em></span>, or <span class="emphasis"><em>exit(2)</em></span> and <span class="emphasis"><em>exit(3)</em></span>. The syntax for accessing the non-default manual section varies between different man implementations. On Linux and <span class="emphasis"><em>BSD, for example, the syntax for reading *printf(3)</em></span> is:</p>
-<pre class="programlisting">
-$man 3 printf</pre>
-<p id="ch9Using_Linux_Tools_69">Another example:</p>
-<pre class="programlisting">
-$man man</pre>
-<p id="ch9Using_Linux_Tools_6a">The previous example will take you to the "Manual" page entry about manual pages!</p>
-<div class="section" title="4.2.1.Layout">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2967561"></a>4.2.1.Layout</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_6b">All man pages follow a common layout that is optimized for presentation on a simple ASCII text display, possibly without any form of highlighting or font control. Sections present may include:</p>NAME<p id="ch9Using_Linux_Tools_6c">The name of the command or function, followed by a one-line description of what it does.</p>SYNOPSIS<p id="ch9Using_Linux_Tools_6d">In the case of a command, you get a formal description of how to run it and what command line options it takes. For program functions, a list of the parameters the function takes and which header file contains its definition. For experienced users, this may be all the documentation they need.</p>DESCRIPTION<p id="ch9Using_Linux_Tools_6e">A textual description of the functioning of the command or function.</p>EXAMPLES<p id="ch9Using_Linux_Tools_6f">Some examples of common usage.</p>SEE ALSO<p id="ch9Using_Linux_Tools_70">A list of related commands or functions.</p>
-<p id="ch9Using_Linux_Tools_71">Other sections may be present, but these are not well standardized across man pages. Common examples include: OPTIONS, EXIT STATUS, ENVIRONMENT, KNOWN BUGS, FILES, AUTHOR, REPORTING BUGS, HISTORY and COPYRIGHT.</p>
-<p id="ch9Using_Linux_Tools_72">These days virtually every Unix command line application comes with its man page, and many Unix users perceive a lack of man pages as a sign of low quality; indeed, some projects, such as Debian, go out of their way to write man pages for programs lacking one. Few alternatives to <span class="emphasis"><em>man</em></span> have enjoyed much popularity, with the possible exception of the GNU project's "info" system, an early and simple hypertext system.</p>
-<p id="ch9Using_Linux_Tools_73">However, the format of a single page for each application, the lack of classification within the sections and the relatively unsophisticated formatting facilities have motivated the development of alternative documentation systems, such as the previously mentioned "info" system.</p>
-<p id="ch9Using_Linux_Tools_74">Most Unix GUI applications (particularly those built using the GNOME and KDE development environments) now provide end-user documentation in HTML and include embedded HTML viewers such as yelp for reading the help within the application.</p>
-<p id="ch9Using_Linux_Tools_75">Usually the man pages are written in English. Translations into other languages can be also available on the system.</p>
-<p id="ch9Using_Linux_Tools_76">The default format of the man pages is troff, with either the macro package man (appearance oriented) or on some systems mdoc (semantic oriented). This makes it possible to typeset a man page to PostScript, PDF and various other formats for viewing or printing.</p>
-</div>
-</div>
-<div class="section" title="4.3.info">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967672"></a>4.3.info</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_77"><span class="emphasis"><em>info</em></span> is a software utility which forms a hypertextual, multipage documentation and help viewer working on a command line interface, useful when there is no GUI available.</p>
-<p id="ch9Using_Linux_Tools_78">The syntax is</p>
-<pre class="programlisting">
-$ info &lt;command_name&gt;</pre>
-<p id="ch9Using_Linux_Tools_79"><span class="emphasis"><em>info</em></span> processes info files, which are Texinfo formatted files, and presents the documentation as a tree, with simple commands to traverse the tree and to follow cross references. For instance</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_7a"><span class="emphasis"><em>n</em></span> goes to the next page.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_7b"><span class="emphasis"><em>p</em></span> goes to the previous page.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_7c"><span class="emphasis"><em>u</em></span> goes to the upper page.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_7d"><span class="emphasis"><em>l</em></span> goes to the last(visited) node</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_7e">To follow a cross reference, the cursor can be moved over a link (a word preceded by a *) and enter pressed.</p></li>
-</ul></div>
-<p id="ch9Using_Linux_Tools_7f">info was initially written for use with GNU/Linux and then ported to other Unix-like operating systems.</p>
-</div>
-<div class="section" title="4.4.--help">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967759"></a>4.4.--help</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_80">Most GNU commands support the --help, which gives a short explanation about how to use the command and a list of available options. Below is the output of this option with the <span class="emphasis"><em>cat</em></span> command:</p>
-<pre class="programlisting">
-$ userprompt@host: cat --help
-Usage: cat [OPTION] [FILE]...
-Concatenate FILE(s), or standard input, to standard output.
-
-  -A, --show-all           equivalent to -vET
-  -b, --number-nonblank    number nonempty output lines
-  -e                       equivalent to -vE
-  -E, --show-ends          display $ at end of each line
-  -n, --number             number all output lines
-  -s, --squeeze-blank      suppress repeated empty output lines
-  -t                       equivalent to -vT
-  -T, --show-tabs          display TAB characters as ^I
-  -u                       (ignored)
-  -v, --show-nonprinting   use ^ and M- notation, except for LFD and              TAB
-  --help     display this help and exit
-  --version  output version information and exit
-
-With no FILE, or when FILE is -, read standard input.
-
-Examples:
-  cat f - g  Output f's contents, then standard input, then g's           contents.
-  cat        Copy standard input to standard output.
-
-Report bugs to &lt;bug-coreutils@gnu.org&gt;.</pre>
-</div>
-</div>
-<div class="section" title="5.Basic file handling">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2967812"></a>5.Basic file handling</h2></div></div></div>
-<div class="section" title="5.1.cp">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2967820"></a>5.1.cp</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_81"><span class="emphasis"><em>cp</em></span> is the command entered in a Unix shell to copy a file from one place to another, possibly on a different filesystem. The original file remains unchanged, and the new file may have the same or a different name.</p>
-<div class="section" title="5.1.1.Usage">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2967838"></a>5.1.1.Usage</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_82">To copy a file to another file:</p>
-<pre class="programlisting">
-$ cp [ -f ] [ -H ] [ -i ] [ -p ][ -- ] SourceFile TargetFile</pre>
-<p id="ch9Using_Linux_Tools_83">To copy a file to a directory:</p>
-<pre class="programlisting">
-$ cp [ -f ] [ -H ] [ -i ] [ -p ] [ -r | -R ] [ -- ] SourceFile ...              TargetDirectory</pre>
-<p id="ch9Using_Linux_Tools_84">To copy a directory to a directory:</p>
-<pre class="programlisting">
-$ cp [ -f ] [ -H ] [ -i ] [ -p ] [ -- ] { -r | -R }
-SourceDirectory ... TargetDirectory</pre>
-</div>
-<div class="section" title="5.1.2.Flags">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2967872"></a>5.1.2.Flags</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_85"><span class="emphasis"><em>-f</em></span> (force)  specifies removal of the target file if it cannot be opened for write operations. The removal precedes any copying performed by the cp command.</p>
-<p id="ch9Using_Linux_Tools_86"><span class="emphasis"><em>-P</em></span>  makes the cp command copy symbolic links. The default is to follow symbolic links, that is, to copy files to which symbolic links point.</p>
-<p id="ch9Using_Linux_Tools_87"><span class="emphasis"><em>-i</em></span> (interactive)  prompts you with the name of a file to be overwritten. This occurs if the TargetDirectory or TargetFile parameter contains a file with the same name as a file specified in the SourceFile or SourceDirectory parameter. If you enter y or the locale's equivalent of y, the cp command continues. Any other answer prevents the cp command from overwriting the file.</p>
-<p id="ch9Using_Linux_Tools_88"><span class="emphasis"><em>-p</em></span> (preserve)  duplicates the following characteristics of each SourceFile/SourceDirectory in the corresponding TargetFile and/or TargetDirectory:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_89">The time of the last data modification and the time of the last access.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_8a">The user ID and group ID (only if it has permissions to do this)</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_8b">The file permission bits and the SUID and SGID bits.</p></li>
-</ul></div>
-<p id="ch9Using_Linux_Tools_8c"><span class="emphasis"><em>-R</em></span> (recursive)  copy directories (recursively copying all the contents)</p>
-</div>
-<div class="section" title="5.1.3.Examples">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2967970"></a>5.1.3.Examples</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_8d">To make a copy of a file in the current directory, enter:</p>
-<pre class="programlisting">
-$ cp prog.c prog.bak</pre>
-<p id="ch9Using_Linux_Tools_8e">This copies prog.c to prog.bak. If the prog.bak file does not already exist, the cp command creates it. If it does exist, the cp command replaces it with a copy of the prog.c file.</p>
-<p id="ch9Using_Linux_Tools_8f">To copy a file in your current directory into another directory, enter:</p>
-<pre class="programlisting">
-$ cp zaphod /home/books/hhgg</pre>
-<p id="ch9Using_Linux_Tools_90">This copies the jones file to /home/books/hhgg/zaphod.</p>
-<p id="ch9Using_Linux_Tools_91">To copy a file to a new file and preserve the modification date, time, and access control list associated with the source file, enter:</p>
-<pre class="programlisting">
-$ cp -p martin_luther_king martin_luther_king.jr</pre>
-<p id="ch9Using_Linux_Tools_92">This copies the <span class="emphasis"><em>martin_luther_king</em></span> file to the <span class="emphasis"><em>martin_luther_king.jr</em></span> file. Instead of creating the file with the current date and time stamp, the system gives the <span class="emphasis"><em>martin_luther_king.jr</em></span> file the same date and time as the <span class="emphasis"><em>martin_luther_king</em></span> file. The <span class="emphasis"><em>martin_luther_king.jr</em></span> file also inherits the <span class="emphasis"><em>martin_luther_king</em></span> file's access control protection.</p>
-<p id="ch9Using_Linux_Tools_93">To copy all the files in a directory to a new directory, enter:</p>
-<pre class="programlisting">
-$ cp /home/galactica/clients/* /home/hhgg/customers</pre>
-<p id="ch9Using_Linux_Tools_94">This copies only the files in the clients directory to the customers directory.</p>
-<p id="ch9Using_Linux_Tools_95">To copy a directory, including all its files and subdirectories, to another directory, enter:</p>
-<p id="ch9Using_Linux_Tools_96">$ cp -R /home/hhgg/clients /home/hhgg/customers</p>
-<p id="ch9Using_Linux_Tools_97">This copies the clients directory, including all its files, subdirectories, and the files in those subdirectories, to the customers/clients directory.</p>
-<p id="ch9Using_Linux_Tools_98">To copy a specific set of files of any extension to another directory, enter:</p>
-<pre class="programlisting">
-$ cp zaphod arthur ford /home/hhgg/clients</pre>
-<p id="ch9Using_Linux_Tools_99">This copies the <span class="emphasis"><em>zaphod</em></span>, <span class="emphasis"><em>arthur</em></span>, and <span class="emphasis"><em>ford</em></span> files in your current working directory to the /home/hhgg/clients directory.</p>
-<p id="ch9Using_Linux_Tools_9a">To use pattern-matching characters to copy files, enter:</p>
-<pre class="programlisting">
-$ cp programs/*.py .</pre>
-<p id="ch9Using_Linux_Tools_9b">This copies the files in the programs directory that end with <span class="emphasis"><em>.py</em></span> to the current directory, signified by the single "." (dot). You must type a space between the <span class="emphasis"><em>py</em></span> and the final dot.</p>
-</div>
-</div>
-<div class="section" title="5.2.mv">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2968133"></a>5.2.mv</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_9c"><span class="emphasis"><em>mv</em></span> (short for move) is a Unix command that moves one or more files or directories from one place to another. The original file is deleted, and the new file may have the same or a different name. If possible (i.e. when the original and new files are on the same file system), <span class="emphasis"><em>mv</em></span> will rename the file instead. Write permission is required on all directories being modified.</p>
-<div class="section" title="5.2.1.Conflicting existing file">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2968157"></a>5.2.1.Conflicting existing file</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_9d">In all cases, when a file is moved to have the name of an existing file (in the same directory), the existing file is deleted. If the existing file is not writable but is in a directory that is writable, then the mv command asks for confirmation if possible (i.e. if run from a terminal) before proceeding, unless the -f (force) option is used.</p>
-</div>
-<div class="section" title="5.2.2.Differences with copy and delete">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2968176"></a>5.2.2.Differences with copy and delete</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_9e">Note that, usually, when moving files within the same volume, moving (and/or renaming) is not the same as simply copying and then deleting the original. When moving a file, the link is simply removed from the old parent directory and added to the new parent directory. However, the file itself is untouched (i.e. it has the same inodes and resides at the same place on the disk). For example, you cannot copy a file you cannot read, but you can move (and/or rename) it (provided you have write permission to its old and new parent directories). Also, suppose there is a non-empty directory you do not have write permission to. You cannot delete this directory (since you cannot delete its contents); but you can move (and/or rename) it. Also, since moving between filenames on a single volume does not involve copying, it is faster and does not place strain of lots of reads and writes on the disk. Moving files across different volumes, however, does necessitate copying and deleting.</p>
-</div>
-<div class="section" title="5.2.3.Examples">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2968207"></a>5.2.3.Examples</h4></div></div></div>
-<pre class="programlisting">
-$ mv myfile mynewfilename    renames a file
-$ mv myfile otherfilename    renames a file and deletes the existing            file "myfile"
-$ mv myfile /myfile          moves 'myfile' from the current            directory to the root directory
-$ mv myfile dir/myfile       moves 'myfile' to 'dir/myfile' relative            to the current directory
-$ mv myfile dir              same as the previous command (the          filename is implied to be the same)
-$ mv myfile dir/myfile2      moves 'myfile' to dir and renames it to            'myfile2'
-$ mv foo bar baz dir         moves multiple files to directory dir
-$ mv --help                  shows a very concise help about the                syntax of the command
-$ man mv                     prints an extensive user manual for                'mv' in the terminal</pre>
-<p id="ch9Using_Linux_Tools_9f">In all cases, the file or files being moved or renamed can be a directory.</p>
-<p id="ch9Using_Linux_Tools_a0">Note that when the command is called with two arguments (as <span class="emphasis"><em>mv name1 name2</em></span> or <span class="emphasis"><em>mv name1 /dir/name2</em></span>), it can have three different effects, depending on whether <span class="emphasis"><em>name2</em></span> does not exist, is an existing file, or is an existing directory. If the user intends to refer to an existing directory, <span class="emphasis"><em>/.</em></span> (or in some Unix versions <span class="emphasis"><em>/</em></span> is sufficient) may be appended to the name to force the system to check this. To move a file to a new directory, the directory must be created first.</p>
-</div>
-</div>
-<div class="section" title="5.3.rm">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2968265"></a>5.3.rm</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_a1"><span class="emphasis"><em>rm</em></span> (short for "remove") is one of several basic Unix command lines that operates on files. It is used to delete files from a filesystem. The data is not actually destroyed. Only the index listing where the file is stored is destroyed, and the storage is made available for reuse. There are undelete utilities that will attempt to reconstruct the index and can bring the file back if the parts were not reused.</p>
-<p id="ch9Using_Linux_Tools_a2">Here's example to remove a file named "foo" from a directory, here shown with the -i option:</p>
-<pre class="programlisting">
-$ rm -i foo
-remove foo? y</pre>
-<div class="section" title="5.3.1.Options">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2968295"></a>5.3.1.Options</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_a3">Common options that rm accepts include:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_a4"><span class="emphasis"><em>-r</em></span>, which removes directories, removing the contents recursively beforehand (so as not to leave files without a directory to reside in) ("recursive")</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_a5"><span class="emphasis"><em>-i</em></span>, which asks for every deletion to be confirmed ("interactive")</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_a6"><span class="emphasis"><em>-f</em></span>, which ignores non-existent files and overrides any confirmation prompts ("force")</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_a7"><span class="emphasis"><em>-v</em></span>, which shows what is being removed as it happens ("verbose")</p></li>
-</ul></div>
-<p id="ch9Using_Linux_Tools_a8"><span class="emphasis"><em>rm</em></span> is often aliased to "rm -i" so as to avoid accidental deletion of files. If a user still wishes to delete a large number of files without confirmation, they can manually cancel out the -i argument by adding the -f option (as the option specified later on the expanded command line "rm -i -f" takes precedence).</p>
-<p id="ch9Using_Linux_Tools_a9"><span class="emphasis"><em>rm -rf</em></span> (variously, rm -rf /, rm -rf *, and others) is frequently used in jokes and anecdotes about Unix disasters. The rm -rf variant of the command, if run by a superuser on the root directory, would cause the contents of every writable mounted filesystem on the computer to be deleted.</p>
-<p id="ch9Using_Linux_Tools_aa"><span class="emphasis"><em>rm</em></span> is often used in conjunction with xargs to supply a list of files to delete:</p>
-<pre class="programlisting">
-xargs rm &lt; filelist</pre>
-<p id="ch9Using_Linux_Tools_ab">When <span class="emphasis"><em>rm</em></span> is used on a symbolic link, it deletes the link, but does not affect the target of the link.</p>
-</div>
-<div class="section" title="5.3.2.Permissions">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2968394"></a>5.3.2.Permissions</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_ac">Usually, on most filesystems, deleting a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place). (Note that, confusingly for beginners, permissions on the file itself are irrelevant. However, GNU rm asks for confirmation if a write-protected file is to be deleted, unless the -f option is used.)</p>
-<p id="ch9Using_Linux_Tools_ad">To delete a directory (with rm -r), one must delete all of its contents recursively. This requires that one must have read and write and execute permission to that directory (if it's not empty) and all non-empty subdirectories recursively (if there are any). The read permissions are needed to list the contents of the directory in order to delete them. This sometimes leads to an odd situation where a non-empty directory cannot be deleted because one doesn't have write permission to it and so cannot delete its contents; but if the same directory were empty, one would be able to delete it.</p>
-<p id="ch9Using_Linux_Tools_ae">If a file resides in a directory with the sticky bit set, then deleting the file requires one to be the owner of the file.</p>
-</div>
-</div>
-</div>
-<div class="section" title="6.Command Line Arguments">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2968433"></a>6.Command Line Arguments</h2></div></div></div>
-<p id="ch9Using_Linux_Tools_af">In computer command line interfaces, a command line argument is an argument sent to a program being called. In general, a program can take any number of command line arguments, which may be necessary for the program to run, or may even be ignored, depending on the function of that program.</p>
-<p id="ch9Using_Linux_Tools_b0">For example, in Unix and Unix-like environments, an example of a command-line argument is:</p>
-<pre class="programlisting">
-rm file.s</pre>
-<p id="ch9Using_Linux_Tools_b1">"file.s" is a command line argument which tells the program rm to remove the file "file.s".</p>
-<p id="ch9Using_Linux_Tools_b2">Programming languages such as C, C++ and Java allow a program to interpret the command line arguments by handling them as string parameters in the main function.</p>
-<p id="ch9Using_Linux_Tools_b3">A command line option or simply <span class="emphasis"><em>option</em></span> (also known as a command line parameter, flag, or a switch) is an indication by a user that a computer program should change its default output.</p>
-<p id="ch9Using_Linux_Tools_b4">Long options are introduced via "--", and are typically whole words. For example, <span class="emphasis"><em>ls --long --classify --all</em></span>. Arguments to long options are provided with "=", as <span class="emphasis"><em>ls --block-size=1024</em></span>. Some Unix programs use long options with single dashes, for example MPlayer as in <span class="emphasis"><em>mplayer -nosound</em></span>.</p>
-<p id="ch9Using_Linux_Tools_b5">Linux also uses "--" to terminate option lists. For example, an attempt to delete a file called <span class="emphasis"><em>-file1</em></span> by using <span class="emphasis"><em>rm -file1</em></span> may produce an error, since rm may interpret <span class="emphasis"><em>-file1</em></span> as a command line switch. Using <span class="emphasis"><em>rm -- -file1</em></span> removes ambiguity.</p>
-</div>
-<div class="section" title="7.Basic Text Processing">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2968526"></a>7.Basic Text Processing</h2></div></div></div>
-<div class="section" title="7.1.head">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2968535"></a>7.1.head</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_b6"><span class="emphasis"><em>head</em></span> is a program on Unix and Unix-like systems used to display the first few lines of a text file or piped data. The command syntax is:</p>
-<pre class="programlisting">
-$ head [options] &lt;file_name&gt;</pre>
-<p id="ch9Using_Linux_Tools_b7">By default, <span class="emphasis"><em>head</em></span> will print the first 10 lines of its input to the standard output. The number of lines printed may be changed with a command line option. The following example shows the first 20 lines of filename:</p>
-<pre class="programlisting">
-$ head -n 20 filename</pre>
-<p id="ch9Using_Linux_Tools_b8">This displays the first 5 lines of all files starting with <span class="emphasis"><em>foo</em></span>:</p>
-<pre class="programlisting">
-$ head -n 5 foo*</pre>
-<p id="ch9Using_Linux_Tools_b9">Some versions omit the n and just let you say -5.</p>
-<div class="section" title="7.1.1.Flags">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2968586"></a>7.1.1.Flags</h4></div></div></div>
-<pre class="programlisting">
--c &lt;x number of bytes&gt; Copy first x number of bytes.</pre>
-<p id="ch9Using_Linux_Tools_ba">Other options: <span class="emphasis"><em>sed</em></span></p>
-<p id="ch9Using_Linux_Tools_bb">Many early versions of Unix did not have this command, and so documentation and books had <span class="emphasis"><em>sed</em></span> do this job:</p>
-<pre class="programlisting">
-sed 5q foo</pre>
-<p id="ch9Using_Linux_Tools_bc">This says to print every line (implicit), and quit after the fifth.</p>
-</div>
-</div>
-<div class="section" title="7.2.tail">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2968622"></a>7.2.tail</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_bd"><span class="emphasis"><em>tail</em></span> is a program on Unix and Unix-like systems used to display the last few lines of a text file or piped data.</p>
-<p id="ch9Using_Linux_Tools_be">The command-syntax is:</p>
-<pre class="programlisting">
-$ tail [options] &lt;file_name&gt;</pre>
-<p id="ch9Using_Linux_Tools_bf">By default, <span class="emphasis"><em>tail</em></span> will print the last 10 lines of its input to the standard output. With command line options the number of lines printed and the printing units (lines, blocks or bytes) may be changed. The following example shows the last 20 lines of filename:</p>
-<pre class="programlisting">
-$ tail -n 20 filename</pre>
-<p id="ch9Using_Linux_Tools_c0">This example shows the last 15 bytes of all files starting with <span class="emphasis"><em>foo</em></span>:</p>
-<pre class="programlisting">
-$ tail -c 15 foo*</pre>
-<p id="ch9Using_Linux_Tools_c1">This example shows all lines of filename from the second line onwards:</p>
-<pre class="programlisting">
-$ tail -n +2 filename</pre>
-<p id="ch9Using_Linux_Tools_c2">Using an older syntax (still used in Sun Solaris as the -n option is not supported), the last 20 lines and the last 50 bytes of filename can be shown with the following command:</p>
-<pre class="programlisting">
-$ tail -20 filename
-$ tail -50c filename</pre>
-<p id="ch9Using_Linux_Tools_c3">However this syntax is now obsolete and does not conform with the POSIX 1003.1-2001 standard. Even if still supported in current versions, when used with other options (like -f, see below), these switches could not work at all.</p>
-<div class="section" title="7.2.1.File monitoring">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2968701"></a>7.2.1.File monitoring</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_c4"><span class="emphasis"><em>tail</em></span> has a special command line option <span class="emphasis"><em>-f</em></span> (follow) that allows a file to be monitored. Instead of displaying the last few lines and exiting, tail displays the lines and then monitors the file. As new lines are added to the file by another process, tail updates the display. This is particularly useful for monitoring log files. The following command will display the last 10 lines of messages and append new lines to the display as new lines are added to messages:</p>
-<pre class="programlisting">
-$ tail -f /var/adm/messages</pre>
-<p id="ch9Using_Linux_Tools_c5">To interrupt tail while it is monitoring, break-in with <span class="emphasis"><em>Ctrl+C</em></span>. This command can be run "in the background" with &amp;, see job control.</p>
-<p id="ch9Using_Linux_Tools_c6">If you have a command's result to monitor, you can use the <span class="emphasis"><em>watch</em></span> command.</p>
-</div>
-</div>
-<div class="section" title="7.3.cut">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2968750"></a>7.3.cut</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_c7">In computing, <span class="emphasis"><em>cut</em></span> is a Unix command line utility which is used to extract sections from each line of input  usually from a file.</p>
-<p id="ch9Using_Linux_Tools_c8">Extraction of line segments can typically be done by <span class="emphasis"><em>bytes (-b), characters (-c)</em></span>, or <span class="emphasis"><em>fields (-f)</em></span> separated by a <span class="emphasis"><em>delimiter (-d  the tab character by default)</em></span>. A range must be provided in each case which consists of one of N, N-M, N- (N to the end of the line), or -M (beginning of the line to M), where N and M are counted from 1 (there is no zeroth value). Since version 6, an error is thrown if you include a zeroth value. Prior to this the value was ignored and assumed to be 1.</p>
-<p id="ch9Using_Linux_Tools_c9">Assuming a file named file containing the lines:</p>
-<pre class="programlisting">
-foo:bar:baz:qux:quux
-one:two:three:four:five:six:seven
-alpha:beta:gamma:delta:epsilon:zeta:eta:teta:iota:kappa:lambda:mu</pre>
-<p id="ch9Using_Linux_Tools_ca">To output the fourth through tenth characters of each line:</p>
-<pre class="programlisting">
-$ cut -c 4-10 file</pre>
-<p id="ch9Using_Linux_Tools_cb">This gives the output:</p>
-<pre class="programlisting">
-:bar:ba
-:two:th
-ha:beta</pre>
-<p id="ch9Using_Linux_Tools_cc">To output the fifth field through the end of the line of each line using the colon character as the field delimiter:</p>
-<pre class="programlisting">
-$ cut -d : -f 5- file</pre>
-<p id="ch9Using_Linux_Tools_cd">This gives the output:</p>
-<pre class="programlisting">
-quux
-five:six:seven
-epsilon:zeta:eta:teta:iota:kappa:lambda:mu</pre>
-</div>
-<div class="section" title="7.4.paste">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2968837"></a>7.4.paste</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_ce"><span class="emphasis"><em>paste</em></span> is a Unix command line utility which is used to join files horizontally (parallel merging) by outputting lines consisting of the sequentially corresponding lines of each file specified, separated by tabs, to the standard output. It is effectively the horizontal equivalent to the utility <span class="emphasis"><em>cat</em></span> command which operates on the vertical plane of two or more files.</p>
-<p id="ch9Using_Linux_Tools_cf">To paste several columns of data together into the file <span class="emphasis"><em>www</em></span> from files <span class="emphasis"><em>who</em></span>, <span class="emphasis"><em>where</em></span>, and <span class="emphasis"><em>when</em></span>:</p>
-<pre class="programlisting">
-$ paste who where when &gt; www</pre>
-<p id="ch9Using_Linux_Tools_d0">If the files contain:</p>
-<p id="ch9Using_Linux_Tools_d1">who</p>
-<p id="ch9Using_Linux_Tools_d2">where</p>
-<p id="ch9Using_Linux_Tools_d3">when</p>
-<p id="ch9Using_Linux_Tools_d4">Batman</p>
-<p id="ch9Using_Linux_Tools_d5">GothamCity</p>
-<p id="ch9Using_Linux_Tools_d6">January 3</p>
-<p id="ch9Using_Linux_Tools_d7">Trillian</p>
-<p id="ch9Using_Linux_Tools_d8">Andromeda</p>
-<p id="ch9Using_Linux_Tools_d9">February 4</p>
-<p id="ch9Using_Linux_Tools_da">Jeeves</p>
-<p id="ch9Using_Linux_Tools_db">London</p>
-<p id="ch9Using_Linux_Tools_dc">March 19</p>
-<p id="ch9Using_Linux_Tools_dd">This creates the file named <span class="emphasis"><em>www</em></span> containing:</p>
-<pre class="programlisting">
-Batman            GothamCity       January 3
-Trillian          Andromeda        February 4
-Jeeves            London           March 19</pre>
-</div>
-</div>
-<div class="section" title="8.Shell Meta Characters">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2968957"></a>8.Shell Meta Characters</h2></div></div></div>
-<p id="ch9Using_Linux_Tools_de">Unix recognizes certain special characters, called "meta characters," as command directives. The shell meta characters are recognized anywhere they appear in the command line, even if they are not surrounded by blank space. For that reason, it is safest to only use the characters A-Z, a-z, 0-9, and the period, dash, and underscore characters when naming files and directories on Unix. If your file or directory has a shell meta character in the name, you will find it difficult to use the name in a shell command.</p>
-<p id="ch9Using_Linux_Tools_df">The shell meta characters include:</p>
-<p id="ch9Using_Linux_Tools_e0">/ &lt; &gt; ! $ % ^ &amp; * | { } [ ] " ' ` ~ ;</p>
-<p id="ch9Using_Linux_Tools_e1">Different shells may differ in the meta characters recognized.</p>
-<p id="ch9Using_Linux_Tools_e2">As an example,</p>
-<pre class="programlisting">
-$ ls file.*</pre>
-<p id="ch9Using_Linux_Tools_e3">run on a directory containing the files file, file.c, file.lst, and myfile would list the files file.c and file.lst. However,:</p>
-<pre class="programlisting">
-$ ls file.?</pre>
-<p id="ch9Using_Linux_Tools_e4">run on the same directory would only list file.c because the ? only matches one character, no more, no less. This can save you a great deal of typing time. For example, if there is a file called california_cornish_hens_with_wild_rice and no other files whose names begin with 'c', you could view the file without typing the whole name by typing this:</p>
-<pre class="programlisting">
-$ more c*</pre>
-<p id="ch9Using_Linux_Tools_e5">because the c* matches that long file name.</p>
-<p id="ch9Using_Linux_Tools_e6">Filenames containing metacharacters can pose many problems and should never be intentionally created. If you do find that you've created a file with metacharacters, and you would like to remove it, you have three options. You may use wildcards to match metacharacter, use the  to directly enter the filename, or put the command in double quotes (except in the case of double quotes within the file name, these must be captured with one of the first two methods). For example, deleting a file named "``*`|more"` can be accomplished with:</p>
-<pre class="programlisting">
-$ rm ??more</pre>
-<p id="ch9Using_Linux_Tools_e7">or:</p>
-<pre class="programlisting">
-$ rm $ backslash$*$ backslash$|more</pre>
-<p id="ch9Using_Linux_Tools_e8">or:</p>
-<pre class="programlisting">
-$ rm ''*|more''</pre>
-</div>
-<div class="section" title="9.Looking At Files">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2969064"></a>9.Looking At Files</h2></div></div></div>
-<div class="section" title="9.1.cat">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2969072"></a>9.1.cat</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_e9">The <span class="emphasis"><em>cat</em></span> command is a standard Unix program used to concatenate and display files. The name is from "catenate", a synonym of <span class="emphasis"><em>concatenate</em></span>.</p>
-<p id="ch9Using_Linux_Tools_ea">The Single Unix Specification specifies the behavior that the contents of each of the files given in sequence as arguments will be written to the standard output in the same sequence, and mandates one option, -u, where each byte is printed as it is read.</p>
-<p id="ch9Using_Linux_Tools_eb">If the filename is specified as -, then <span class="emphasis"><em>cat</em></span> will read from standard input at that point in the sequence. If no files are specified, <span class="emphasis"><em>cat</em></span> will read from standard input entered.</p>
-<div class="section" title="9.1.1.Jargon File Definition">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969116"></a>9.1.1.Jargon File Definition</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_ec">The Jargon File version 4.4.7 lists this as the definition of <span class="emphasis"><em>cat</em></span>:</p>
-<pre class="programlisting">
-1. To spew an entire file to the screen or some other output sink without
-     pause (syn. blast).
-
-2. By extension, to dump large amounts of data at an unprepared target or
-     with no intention of browsing it carefully. Usage: considered silly.
-     Rare outside Unix sites. See also dd, BLT.
-
-     Among Unix fans, *cat(1)* is considered an excellent example of
-     user-interface design, because it delivers the file contents without
-     such verbosity as spacing or headers between the files, and because
-     it does not require the files to consist of lines of text, but works
-     with any sort of data.
-
-     Among Unix critics, *cat(1)* is considered the canonical example of
-     bad user-interface design, because of its woefully unobvious name.
-     It is far more often used to blast a single file to standard output
-     than to concatenate two or more files. The name cat for the former
-     operation is just as unintuitive as, say, LISP's cdr.
-
-     Of such oppositions are holy wars made...</pre>
-</div>
-<div class="section" title="9.1.2.Useless Use of 'cat'">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969155"></a>9.1.2.Useless Use of 'cat'</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_ed">UUOC (from comp.unix.shell on Usenet) stands for Useless Use of cat. As it is observed on <span class="emphasis"><em>comp.unix.shell</em></span>, The purpose of cat is to concatenate (or 'catenate') files. If it's only one file, concatenating it with nothing at all is a waste of time, and costs you a process.</p>
-<p id="ch9Using_Linux_Tools_ee">Nevertheless one sees people doing:</p>
-<pre class="programlisting">
-$ cat file | some_command and its args ...</pre>
-<p id="ch9Using_Linux_Tools_ef">instead of the equivalent and cheaper:</p>
-<pre class="programlisting">
-&lt;file some_command and its args ...</pre>
-<p id="ch9Using_Linux_Tools_f0">or (equivalently and more classically):</p>
-<pre class="programlisting">
-some_command and its args ... &lt;file</pre>
-<p id="ch9Using_Linux_Tools_f1">Since 1995, occasional awards for UUOC have been given out. The activity of fixing instances of UUOC is sometimes called 'demoggification'.</p>
-<p id="ch9Using_Linux_Tools_f2">Amongst many, it is still considered safer to use <span class="emphasis"><em>cat</em></span> for such cases given that the &lt; and &gt; keys are next to each other in many popular keyboard mappings. While the risk might be low, the impact of using &gt; instead of &lt; can be high and prohibitive.</p>
-</div>
-<div class="section" title="9.1.3.zcat">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969226"></a>9.1.3.zcat</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_f3"><span class="emphasis"><em>zcat</em></span> is a Unix program similar to <span class="emphasis"><em>cat</em></span>, that decompresses individual files and concatenates them to standard output. Traditionally <span class="emphasis"><em>zcat</em></span> operated on files compressed by compress but today it is usually able to operate on <span class="emphasis"><em>gzip</em></span> or even <span class="emphasis"><em>bzip2</em></span> archives. On such systems, it is equivalent to <span class="emphasis"><em>gunzip -c</em></span></p>
-</div>
-</div>
-<div class="section" title="9.2.more">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2969260"></a>9.2.more</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_f4">In computing, <span class="emphasis"><em>more</em></span> is a command to view (but not modify) the contents of a text file one screen at a time (terminal pager). It is available on Unix and Unix-like systems, DOS, OS/2 and Microsoft Windows. Programs of this sort are called pagers.</p>
-<div class="section" title="9.2.1.Usage">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969280"></a>9.2.1.Usage</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_f5">The command-syntax is:</p>
-<pre class="programlisting">
-$ more [options] [file_name]</pre>
-<p id="ch9Using_Linux_Tools_f6">If no file name is provided, <span class="emphasis"><em>more</em></span> looks for input from stdin.</p>
-<p id="ch9Using_Linux_Tools_f7">Once <span class="emphasis"><em>more</em></span> has obtained input, it displays as much as can fit on the current screen and waits for user input to advance, with the exception that a form feed (^L) will also cause <span class="emphasis"><em>more</em></span> to wait at that line, regardless of the amount of text on the screen. In the lower-left corner of the screen is displayed the text "--More--" and a percentage, representing the percent of the file that <span class="emphasis"><em>more</em></span> has paged through. (This percentage includes the text displayed on the current screen.) When <span class="emphasis"><em>more</em></span> reaches the end of a file (100%) it exits. The most common methods of navigating through a file are <span class="emphasis"><em>Enter</em></span>, which advances the output by one line, and <span class="emphasis"><em>Space</em></span>, which advances the output by one screen.</p>
-<p id="ch9Using_Linux_Tools_f8">There are also other commands that can be used while navigating through the document; consult <span class="emphasis"><em>more</em></span>'s <span class="emphasis"><em>man</em></span> page for more details.</p>
-<p id="ch9Using_Linux_Tools_f9"><span class="emphasis"><em>Options</em></span> are typically entered before the file name, but can also be entered in the environment variable <span class="emphasis"><em>$MORE</em></span>. Options entered in the actual command line will override those entered in the <span class="emphasis"><em>$MORE</em></span> environment variable. Available options may vary between Unix systems.</p>
-</div>
-</div>
-<div class="section" title="9.3.less">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2969371"></a>9.3.less</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_fa"><span class="emphasis"><em>less</em></span> is a terminal pager program on Unix, Windows and Unix-like systems used to view (but not change) the contents of a text file one screen at a time. It is similar to <span class="emphasis"><em>more</em></span>, but has the extended capability of allowing both forward and backward navigation through the file. Unlike most Unix text editors/viewers, <span class="emphasis"><em>less</em></span> does not need to read the entire file before starting, resulting in faster load times with large files.</p>
-<div class="section" title="9.3.1.Usage">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969400"></a>9.3.1.Usage</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_fb"><span class="emphasis"><em>less</em></span> can be invoked with options to change its behaviour, for example, the number of lines to display on the screen. A few options vary depending on the operating system. While <span class="emphasis"><em>less</em></span> is displaying the file, various commands can be used to navigate through the file. These commands are based on those used by both <span class="emphasis"><em>more</em></span> and <span class="emphasis"><em>vi</em></span>. It is also possible to search for character patterns in the file.</p>
-<p id="ch9Using_Linux_Tools_fc">By default, <span class="emphasis"><em>less</em></span> displays the contents of the file to the standard output (one screen at a time). If the file name argument is omitted, it displays the contents from standard input (usually the output of another command through a pipe). If the output is redirected to anything other than a terminal, for example a pipe to another command, less behaves like cat.</p>
-<p id="ch9Using_Linux_Tools_fd">The command-syntax is:</p>
-<pre class="programlisting">
-$ less [options] file_name</pre>
-</div>
-<div class="section" title="9.3.2.Frequently Used Options">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969455"></a>9.3.2.Frequently Used Options</h4></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_fe">-g: Highlights just the current match of any searched string.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_ff">-I: Case-insensitive searches.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_100">-M: Shows more detailed prompt, including file position.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_101">-N: Shows line numbers (useful for source code viewing).</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_102">-S: Disables line wrap ("chop long lines"). Long lines can be seen by side scrolling.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_103">-?: Shows help.</p></li>
-</ul></div>
-</div>
-<div class="section" title="9.3.3.Frequently Used Commands">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969507"></a>9.3.3.Frequently Used Commands</h4></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_104">[Arrows]/[Page Up]/[Page Down]/[Home]/[End]: Navigation.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_105">[Space bar]: Next page.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_106">b: Previous page.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_107">ng: Jump to line number n. Default is the start of the file.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_108">nG: Jump to line number n. Default is the end of the file.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_109">/pattern: Search for pattern. Regular expressions can be used.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_10a">'^ or g: Go to start of file.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_10b">'$ or G: Go to end of file.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_10c">s: Save current content (got from another program like grep) in a file.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_10d">=: File information.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_10e">h: Help.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_10f">q: Quit.</p></li>
-</ul></div>
-</div>
-<div class="section" title="9.3.4.Examples">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969597"></a>9.3.4.Examples</h4></div></div></div>
-<pre class="programlisting">
-$ less -M readme.txt                     #Read "readme.txt."
-$ less +F /var/log/mail.log              #Follow mode for log
-$ file * | less                          #Easier file analysis.
-$ grep -i void *.c | less -I -p void     #Case insensitive search                                                         for "void" in all .c files</pre>
-</div>
-</div>
-</div>
-<div class="section" title="10.Directory Structure">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2969612"></a>10.Directory Structure</h2></div></div></div>
-<p id="ch9Using_Linux_Tools_110">In the File Hierarchy Standard (FHS) all files and directories appear under the root directory "/", even if they are stored on different physical devices. Note however that some of these directories may or may not be present on a Unix system depending on whether certain subsystems, such as the X Window System, are installed.</p>
-<p id="ch9Using_Linux_Tools_111">The majority of these directories exist in all UNIX operating systems and are generally used in much the same way; however, the descriptions here are those used specifically for the FHS, and are not considered authoritative for platforms other than Linux.</p>
-<p id="ch9Using_Linux_Tools_112">Directory</p>
-<p id="ch9Using_Linux_Tools_113">Description</p>
-<p id="ch9Using_Linux_Tools_114">/</p>
-<p id="ch9Using_Linux_Tools_115">Primary hierarchy root and root directory of
-the entire file system hierarchy.</p>
-<p id="ch9Using_Linux_Tools_116">/bin/</p>
-<p id="ch9Using_Linux_Tools_117">Essential command binaries that need to be
-available in single user mode; for all users,
-e.g., <span class="emphasis"><em>cat</em></span>, <span class="emphasis"><em>ls</em></span>, <span class="emphasis"><em>cp</em></span>.</p>
-<p id="ch9Using_Linux_Tools_118">/boot/</p>
-<p id="ch9Using_Linux_Tools_119">Boot loader files, e.g., <span class="emphasis"><em>kernels</em></span>, <span class="emphasis"><em>initrd</em></span>;
-often a separate partition.</p>
-<p id="ch9Using_Linux_Tools_11a">/dev/</p>
-<p id="ch9Using_Linux_Tools_11b">Essential devices, e.g., /dev/null</p>
-<p id="ch9Using_Linux_Tools_11c">/etc/</p>
-<p id="ch9Using_Linux_Tools_11d">Host-specific system-wide configuration files
-(the name comes from <span class="emphasis"><em>et cetera</em></span>)</p>
-<p id="ch9Using_Linux_Tools_11e">/home/</p>
-<p id="ch9Using_Linux_Tools_11f">User's home directories, containing saved
-files, personal settings, etc.; often a
-separate partition.</p>
-<p id="ch9Using_Linux_Tools_120">/lib/</p>
-<p id="ch9Using_Linux_Tools_121">Libraries essential for the binaries in
-<span class="emphasis"><em>/bin/</em></span> and <span class="emphasis"><em>/sbin/</em></span></p>
-<p id="ch9Using_Linux_Tools_122">/media/</p>
-<p id="ch9Using_Linux_Tools_123">Mount points for removable media such as
-CD-ROMs, external hard disks, USB sticks, etc.</p>
-<p id="ch9Using_Linux_Tools_124">/mnt/</p>
-<p id="ch9Using_Linux_Tools_125">Temporarily mounted file systems</p>
-<p id="ch9Using_Linux_Tools_126">/opt/</p>
-<p id="ch9Using_Linux_Tools_127">Optional application software packages</p>
-<p id="ch9Using_Linux_Tools_128">/proc/</p>
-<p id="ch9Using_Linux_Tools_129">Virtual filesystem documenting kernel and
-process status as text files; e.g., uptime,
-network. In Linux, corresponds to a <span class="emphasis"><em>Procfs</em></span>
-mount.</p>
-<p id="ch9Using_Linux_Tools_12a">/root/</p>
-<p id="ch9Using_Linux_Tools_12b">Home directory for the root user</p>
-<p id="ch9Using_Linux_Tools_12c">/sbin/</p>
-<p id="ch9Using_Linux_Tools_12d">Essential system binaries; e.g., <span class="emphasis"><em>init</em></span>,
-<span class="emphasis"><em>route</em></span>, <span class="emphasis"><em>mount</em></span>.</p>
-<p id="ch9Using_Linux_Tools_12e">/srv/</p>
-<p id="ch9Using_Linux_Tools_12f">Site-specific data which is served by the
-system.</p>
-<p id="ch9Using_Linux_Tools_130">/tmp/</p>
-<p id="ch9Using_Linux_Tools_131">Temporary files. Often not preserved between
-system reboots.</p>
-<p id="ch9Using_Linux_Tools_132">/usr/</p>
-<p id="ch9Using_Linux_Tools_133">Secondary hierarchy for read-only user data;
-contains the majority of (multi-)user
-utilities and applications.</p>
-<p id="ch9Using_Linux_Tools_134">/var/</p>
-<p id="ch9Using_Linux_Tools_135">Variable files - files whose content is
-expected to continually change during normal
-operation of the system - such as logs, spool
-files, and temporary e-mail files.
-Sometimes a separate partition.</p>
-<div class="section" title="10.1.man hier">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2969877"></a>10.1.man hier</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_136">This is the manual page on the UNIX filesystem. The syntax for this is:</p>
-<pre class="programlisting">
-$ man hier</pre>
-</div>
-<div class="section" title="10.2.ls -l">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2969893"></a>10.2.ls -l</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_137">Shows you huge amounts of information (permissions, owners, size, and when last modified) for folders and files. The syntax is</p>
-<pre class="programlisting">
-$ ls -l</pre>
-<p id="ch9Using_Linux_Tools_138">This can be done after entering the required directory.</p>
-</div>
-</div>
-<div class="section" title="11.Permissions and Ownership">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2969916"></a>11.Permissions and Ownership</h2></div></div></div>
-<div class="section" title="11.1.chmod">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2969925"></a>11.1.chmod</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_139">The <span class="emphasis"><em>chmod</em></span> command (abbreviated from 'change mode') is a shell command and C language function in Unix and Unix-like environments. When executed, it can change file system modes of files and directories. The modes include permissions and special modes.A chmod command first appeared in AT&amp;T Unix version 1, and is still used today on Unix-like machines.</p>
-<div class="section" title="11.1.1.Usage">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969951"></a>11.1.1.Usage</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_13a">The <span class="emphasis"><em>chmod</em></span> command options are specified like this:</p>
-<pre class="programlisting">
-$ chmod [options] mode[,mode] file1 [file2 ...]</pre>
-<p id="ch9Using_Linux_Tools_13b">To view what the permissions currently are, type:</p>
-<pre class="programlisting">
-$ ls -l file</pre>
-</div>
-<div class="section" title="11.1.2.Command line options">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2969979"></a>11.1.2.Command line options</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_13c">The <span class="emphasis"><em>chmod</em></span> command has a number of command line options that affect its behavior. The most common options are:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_13d">-R: Changes the modes of directories and files recursively</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch9Using_Linux_Tools_13e">-v: Verbose mode; lists all files as they are being processed</p></li>
-</ul></div>
-<div class="section" title="11.1.2.1.Symbolic modes">
-<div class="titlepage"><div><div><h5 class="title">
-<a name="id2970015"></a>11.1.2.1.Symbolic modes</h5></div></div></div>
-<p id="ch9Using_Linux_Tools_13f">To the <span class="emphasis"><em>chmod</em></span> utility, all permissions and special modes are represented by its mode parameter. One way to adjust the mode of files or directories is to specify a symbolic mode. The symbolic mode is composed of three components, which are combined to form a single string of text:</p>
-<pre class="programlisting">
-$ chmod [references][operator][modes] file1 ...</pre>
-<p id="ch9Using_Linux_Tools_140">The references (or classes) are used to distinguish the users to whom the permissions apply. If no references are specified it defaults to all but modifies only the permissions allowed by the umask. The references are represented by one or more of the following letters:</p>
-<p id="ch9Using_Linux_Tools_141">Reference</p>
-<p id="ch9Using_Linux_Tools_142">Class</p>
-<p id="ch9Using_Linux_Tools_143">Description</p>
-<p id="ch9Using_Linux_Tools_144">u</p>
-<p id="ch9Using_Linux_Tools_145">user</p>
-<p id="ch9Using_Linux_Tools_146">the owner of the file</p>
-<p id="ch9Using_Linux_Tools_147">g</p>
-<p id="ch9Using_Linux_Tools_148">group</p>
-<p id="ch9Using_Linux_Tools_149">users who are members of the file's group</p>
-<p id="ch9Using_Linux_Tools_14a">o</p>
-<p id="ch9Using_Linux_Tools_14b">others</p>
-<p id="ch9Using_Linux_Tools_14c">users who are not hte owner of the file or
-members of the group</p>
-<p id="ch9Using_Linux_Tools_14d">a</p>
-<p id="ch9Using_Linux_Tools_14e">all</p>
-<p id="ch9Using_Linux_Tools_14f">all three of the above; is the same as <span class="emphasis"><em>ugo</em></span></p>
-<p id="ch9Using_Linux_Tools_150">The <span class="emphasis"><em>chmod</em></span> program uses an operator to specify how the modes of a file should be adjusted. The following operators are accepted:</p>
-<p id="ch9Using_Linux_Tools_151">Operator</p>
-<p id="ch9Using_Linux_Tools_152">Description</p>
-<div class="itemizedlist">
-<span style="color: red">&lt;list_item&gt;&lt;/list_item&gt;</span><ul class="itemizedlist" type="*"></ul>
-</div>
-<p id="ch9Using_Linux_Tools_153">adds the specified modes to the specified classes</p>
-<div class="itemizedlist">
-<span style="color: red">&lt;list_item&gt;&lt;/list_item&gt;</span><ul class="itemizedlist" type="*"></ul>
-</div>
-<p id="ch9Using_Linux_Tools_154">removes the specified modes from the specified
-classes</p>
-<p id="ch9Using_Linux_Tools_155">=</p>
-<p id="ch9Using_Linux_Tools_156">the modes specified are to be made the exact modes
-for the specified classes</p>
-<p id="ch9Using_Linux_Tools_157">The modes indicate which permissions are to be granted or taken away from the specified classes. There are three basic modes which correspond to the basic permissions:</p>
-<p id="ch9Using_Linux_Tools_158">Mode</p>
-<p id="ch9Using_Linux_Tools_159">Name</p>
-<p id="ch9Using_Linux_Tools_15a">Description</p>
-<p id="ch9Using_Linux_Tools_15b">r</p>
-<p id="ch9Using_Linux_Tools_15c">read</p>
-<p id="ch9Using_Linux_Tools_15d">read a file or list a directory's contents</p>
-<p id="ch9Using_Linux_Tools_15e">w</p>
-<p id="ch9Using_Linux_Tools_15f">write</p>
-<p id="ch9Using_Linux_Tools_160">write to a file or directory</p>
-<p id="ch9Using_Linux_Tools_161">x</p>
-<p id="ch9Using_Linux_Tools_162">execute</p>
-<p id="ch9Using_Linux_Tools_163">execute a file or recurse a directory tree</p>
-<p id="ch9Using_Linux_Tools_164">X</p>
-<p id="ch9Using_Linux_Tools_165">special
-execute</p>
-<p id="ch9Using_Linux_Tools_166">which is not a permission in itself but rather
-can be used instead of 'x'. It applies execute
-permissions to directories regardless of their
-current permissions and applies execute
-permissions to a file which already has at
-least 1 execute permission bit already set
-(either user, group or other). It is only
-really useful when used with '+' and usually
-in combination with the <span class="emphasis"><em>-R</em></span> option for giving
-group or other access to a big directory tree
-without setting execute permission on normal
-files (such as text files), which would
-normally happen if one just used 'chmod -R
-a+rx .', whereas with 'X' one can do 'chmod -R
-a+rX .' instead.</p>
-<p id="ch9Using_Linux_Tools_167">s</p>
-<p id="ch9Using_Linux_Tools_168">setuid/gid</p>
-<p id="ch9Using_Linux_Tools_169">are Unix access rights flags that allow users
-to run an executable with the permissions of
-the executable's owner or group.They are often
-used to allow users on a computer system to run
-programs with temporarily elevated privileges
-in order to perform a specific task. While the
-assumed user id or group id privileges provided
-are not always elevated, at a minimum they are
-specific.They are needed for tasks that require
-higher privileges than those which a common
-user has, such as changing his or her login
-password.</p>
-<p id="ch9Using_Linux_Tools_16a">t</p>
-<p id="ch9Using_Linux_Tools_16b">sticky</p>
-<p id="ch9Using_Linux_Tools_16c">The most common use of the sticky bit today is
-on directories, where, when set, items inside
-the directory can be renamed or deleted only by
-the item's owner, the directory's owner, or the
-superuser; without the sticky bit set, any user
-with write and execute permissions for the
-directory can rename or delete contained files,
-regardless of owner.</p>
-<p id="ch9Using_Linux_Tools_16d">The combination of these three components produces a string that is understood by the chmod command. Multiple changes can be specified by separating multiple symbolic modes with commas.</p>
-</div>
-<div class="section" title="11.1.2.2.Symbolic examples">
-<div class="titlepage"><div><div><h5 class="title">
-<a name="id2965880"></a>11.1.2.2.Symbolic examples</h5></div></div></div>
-<p id="ch9Using_Linux_Tools_16e">Add the 'read' and 'write' permissions to the 'user' and 'group' classes of a directory:</p>
-<pre class="programlisting">
-$ chmod ug+rw mydir
-$ ls -ld mydir
-drw-rw----   2 starwars  yoda  96 Dec 8 12:53 mydir</pre>
-<p id="ch9Using_Linux_Tools_16f">For a file, remove <span class="emphasis"><em>write</em></span> permissions for all classes:</p>
-<pre class="programlisting">
-$ chmod a-w myfile
-$ ls -l myfile
--r-xr-xr-x   2 starwars  yoda 96 Dec 8 12:53 myfile</pre>
-<p id="ch9Using_Linux_Tools_170">Set the permissions for the <span class="emphasis"><em>u*ser and the *g*roup to read and execute only (no write permission) on *mydir</em></span>.</p>
-<pre class="programlisting">
-$ chmod ug=rx mydir
-$ ls -ld mydir
-dr-xr-x---   2 starwars  yoda 96 Dec 8 12:53 mydir</pre>
-</div>
-<div class="section" title="11.1.2.3.Octal numbers">
-<div class="titlepage"><div><div><h5 class="title">
-<a name="id2965925"></a>11.1.2.3.Octal numbers</h5></div></div></div>
-<p id="ch9Using_Linux_Tools_171">The <span class="emphasis"><em>chmod</em></span> command also accepts three and four-digit octal numbers representing modes. Using a three-digit octal number to set the modes of a file named myfile :</p>
-<pre class="programlisting">
-$ chmod 664 myfile
-$ ls -l myfile
--rw-rw-r--  1   57 Jul  3 10:13  myfile</pre>
-<p id="ch9Using_Linux_Tools_172">Since the <span class="emphasis"><em>setuid</em></span>, <span class="emphasis"><em>setgid</em></span> and <span class="emphasis"><em>sticky</em></span> bits are not set, this is equivalent to:</p>
-<pre class="programlisting">
-$ chmod 0664 myfile</pre>
-</div>
-<div class="section" title="11.1.2.4.Special modes">
-<div class="titlepage"><div><div><h5 class="title">
-<a name="id2970552"></a>11.1.2.4.Special modes</h5></div></div></div>
-<p id="ch9Using_Linux_Tools_173">The <span class="emphasis"><em>chmod</em></span> command is also capable of changing the additional permissions or special modes of a file or directory. The symbolic modes use <span class="strong"><strong>s</strong></span> to represent the <span class="emphasis"><em>setuid</em></span> and <span class="emphasis"><em>setgid</em></span> modes, and <span class="strong"><strong>t</strong></span> to represent the sticky mode. The modes are only applied to the appropriate classes, regardless of whether or not other classes are specified.</p>
-<p id="ch9Using_Linux_Tools_174">Most operating systems support the specification of special modes using octal modes, but some do not. On these systems, only the symbolic modes can be used.</p>
-</div>
-</div>
-</div>
-</div>
-<div class="section" title="12.Redirection and Piping">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2965366"></a>12.Redirection and Piping</h2></div></div></div>
-<p id="ch9Using_Linux_Tools_175">In computing, <span class="emphasis"><em>redirection</em></span> is a function common to most command-line interpreters, including the various Unix shells that can redirect standard streams to user-specified locations.</p>
-<p id="ch9Using_Linux_Tools_176">Programs do redirection with the <span class="emphasis"><em>dup2(2)</em></span> system call, or its less-flexible but higher-level stdio analogues, <span class="emphasis"><em>freopen(3)</em></span> and <span class="emphasis"><em>popen(3)</em></span>.</p>
-<div class="section" title="12.1.Redirecting standard input and standard output">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2970852"></a>12.1.Redirecting standard input and standard output</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_177">Redirection is usually implemented by placing certain characters between commands. Typically, the syntax of these characters is as follows:</p>
-<pre class="programlisting">
-$ command1 &gt; file1</pre>
-<p id="ch9Using_Linux_Tools_178">executes <span class="emphasis"><em>command1</em></span>, placing the output in file1. Note that this will truncate any existing data in <span class="emphasis"><em>file1</em></span>. To append output to the end of the file, use the &gt;&gt; operator.:</p>
-<pre class="programlisting">
-$ command1 &lt; file1</pre>
-<p id="ch9Using_Linux_Tools_179">executes <span class="emphasis"><em>command1</em></span>, using <span class="emphasis"><em>file1</em></span> as the source of input (as opposed to the keyboard).:</p>
-<pre class="programlisting">
-$ command1 &lt; infile &gt; outfile</pre>
-<p id="ch9Using_Linux_Tools_17a">combines the two capabilities: <span class="emphasis"><em>command1</em></span> reads from <span class="emphasis"><em>infile</em></span> and writes to <span class="emphasis"><em>outfile</em></span></p>
-</div>
-<div class="section" title="12.2.Piping">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2970920"></a>12.2.Piping</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_17b">Programs can be run together such that one program reads the output from another with no need for an explicit intermediate file:
-A pipeline of three programs run on a text terminal:</p>
-<pre class="programlisting">
-$ command1 | command2</pre>
-<p id="ch9Using_Linux_Tools_17c">executes <span class="emphasis"><em>command1</em></span>, using its output as the input for <span class="emphasis"><em>command2</em></span> (commonly called piping, since the "|" character is known as a "pipe").</p>
-<p id="ch9Using_Linux_Tools_17d">This is equivalent to using two redirects and a temporary file:</p>
-<pre class="programlisting">
-$ command1 &gt; tempfile
-$ command2 &lt; tempfile
-$ rm tempfile</pre>
-<p id="ch9Using_Linux_Tools_17e">A good example for command piping is combining <span class="emphasis"><em>echo</em></span> with another command to achieve something interactive in a non-interactive shell, e.g.:</p>
-<pre class="programlisting">
-$ echo -e "user npass" | ftp localhost</pre>
-<p id="ch9Using_Linux_Tools_17f">This runs the ftp client with input user, press return, then pass.</p>
-</div>
-<div class="section" title="12.3.Redirecting to and from the standard file handles">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2970982"></a>12.3.Redirecting to and from the standard file handles</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_180">In Unix shells derived from the original Bourne shell, the first two actions can be further modified by placing a number (the file descriptor) immediately before the character; this will affect which stream is used for the redirection. The Unix standard I/O streams are:</p>
-<p id="ch9Using_Linux_Tools_181">Handle</p>
-<p id="ch9Using_Linux_Tools_182">Name</p>
-<p id="ch9Using_Linux_Tools_183">Description</p>
-<p id="ch9Using_Linux_Tools_184">0</p>
-<p id="ch9Using_Linux_Tools_185">stdin</p>
-<p id="ch9Using_Linux_Tools_186">Standard input</p>
-<p id="ch9Using_Linux_Tools_187">1</p>
-<p id="ch9Using_Linux_Tools_188">stdout</p>
-<p id="ch9Using_Linux_Tools_189">Standard output</p>
-<p id="ch9Using_Linux_Tools_18a">2</p>
-<p id="ch9Using_Linux_Tools_18b">stderr</p>
-<p id="ch9Using_Linux_Tools_18c">Standard error</p>
-<p id="ch9Using_Linux_Tools_18d">For example:</p>
-<pre class="programlisting">
-$ command1 2&gt; file1</pre>
-<p id="ch9Using_Linux_Tools_18e">executes <span class="emphasis"><em>command1</em></span>, directing the standard error stream to <span class="emphasis"><em>file1</em></span>.</p>
-<p id="ch9Using_Linux_Tools_18f">In shells derived from <span class="emphasis"><em>csh</em></span> (the C shell), the syntax instead appends the &amp; character to the redirect characters, thus achieving a similar result.</p>
-<p id="ch9Using_Linux_Tools_190">Another useful capability is to redirect one standard file handle to another. The most popular variation is to merge standard error into standard output so error messages can be processed together with (or alternately to) the usual output. Example:</p>
-<pre class="programlisting">
-$ find / -name .profile &gt; results 2&gt;&amp;1</pre>
-<p id="ch9Using_Linux_Tools_191">will try to find all files named <span class="emphasis"><em>.profile</em></span>. Executed without redirection, it will output hits to <span class="emphasis"><em>stdout</em></span> and errors (e.g. for lack of privilege to traverse protected directories) to <span class="emphasis"><em>stderr</em></span>. If standard output is directed to file results, error messages appear on the console. To see both hits and error messages in file results, merge <span class="emphasis"><em>stderr</em></span> (handle 2) into <span class="emphasis"><em>stdout</em></span> (handle 1) using 2&gt;&amp;1 .</p>
-<p id="ch9Using_Linux_Tools_192">It's possible use 2&gt;&amp;1 before "&gt;" but it doesn't work. In fact, when the interpreter reads 2&gt;&amp;1, it doesn't know yet where standard output is redirected and then standard error isn't merged.</p>
-<p id="ch9Using_Linux_Tools_193">If the merged output is to be piped into another program, the file merge sequence 2&gt;&amp;1 must precede the pipe symbol, thus:</p>
-<pre class="programlisting">
-$ find / -name .profile 2&gt;&amp;1 | less</pre>
-<p id="ch9Using_Linux_Tools_194">A simplified form of the command:</p>
-<pre class="programlisting">
-$ command &gt; file 2&gt;&amp;1</pre>
-<p id="ch9Using_Linux_Tools_195">is:</p>
-<pre class="programlisting">
-$ command &amp;&gt;file</pre>
-<p id="ch9Using_Linux_Tools_196">or:</p>
-<pre class="programlisting">
-$command &gt;&amp;file</pre>
-</div>
-<div class="section" title="12.4.Chained pipelines">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2971176"></a>12.4.Chained pipelines</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_197">The redirection and piping tokens can be chained together to create complex commands. For example:</p>
-<pre class="programlisting">
-$ ls | grep ' .sh' | sort &gt; shlist</pre>
-<p id="ch9Using_Linux_Tools_198">lists the contents of the current directory, where this output is filtered to only contain lines which contain <span class="emphasis"><em>.sh</em></span>, sort this resultant output lexicographically, and place the final output in <span class="emphasis"><em>shlist</em></span>. This type of construction is used very commonly in shell scripts and batch files.</p>
-</div>
-<div class="section" title="12.5.Redirect to multiple outputs">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2971209"></a>12.5.Redirect to multiple outputs</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_199">The standard command <span class="emphasis"><em>tee</em></span> can redirect output from a command to several destinations.</p>
-<pre class="programlisting">
-$ ls -lrt | tee xyz</pre>
-<p id="ch9Using_Linux_Tools_19a">This directs the file list output to both standard output as well as to the file <span class="emphasis"><em>xyz</em></span>.</p>
-</div>
-</div>
-<div class="section" title="13.More Text Processing">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2971240"></a>13.More Text Processing</h2></div></div></div>
-<div class="section" title="13.1.grep">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2971248"></a>13.1.grep</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_19b"><span class="emphasis"><em>grep</em></span> is a command line text search utility originally written for Unix. The name is taken from the first letters in <span class="emphasis"><em>global / regular expression / print</em></span>, a series of instructions for the <span class="emphasis"><em>ed</em></span> text editor. The <span class="emphasis"><em>grep</em></span> command searches files or standard input globally for lines matching a given regular expression, and prints them to the program's standard output.</p>
-<div class="section" title="13.1.1.Usage">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2971279"></a>13.1.1.Usage</h4></div></div></div>
-<p id="ch9Using_Linux_Tools_19c">This is an example of a common <span class="emphasis"><em>grep</em></span> usage:</p>
-<pre class="programlisting">
-$ grep apple fruitlist.txt</pre>
-<p id="ch9Using_Linux_Tools_19d">In this case, <span class="emphasis"><em>grep</em></span> prints all lines containing 'apple' from the file <span class="emphasis"><em>fruitlist.txt</em></span>, regardless of word boundaries; therefore lines containing 'pineapple' or 'apples' are also printed. The <span class="emphasis"><em>grep</em></span> command is case sensitive by default, so this example's output does not include lines containing 'Apple' (with a capital A) unless they also contain 'apple'.</p>
-<p id="ch9Using_Linux_Tools_19e">Like most Unix commands, <span class="emphasis"><em>grep</em></span> accepts command line arguments to change this and many other behaviors. For example:</p>
-<pre class="programlisting">
-$ grep -i apple fruitlist.txt</pre>
-<p id="ch9Using_Linux_Tools_19f">This prints all lines containing 'apple' regardless of capitalization. The '-i' argument tells <span class="emphasis"><em>grep</em></span> to be case insensitive, or to ignore case.</p>
-<p id="ch9Using_Linux_Tools_1a0">To print all lines containing 'apple' as a word ('pineapple' and 'apples' will not match):</p>
-<pre class="programlisting">
-$ grep -w apple fruitlist.txt</pre>
-<p id="ch9Using_Linux_Tools_1a1">Regular expressions can be used to match more complicated queries.</p>
-<div class="section" title="13.1.1.1.Variations">
-<div class="titlepage"><div><div><h5 class="title">
-<a name="id2971358"></a>13.1.1.1.Variations</h5></div></div></div>
-<p id="ch9Using_Linux_Tools_1a2">There are countless implementations and derivatives of <span class="emphasis"><em>grep</em></span> available for many operating systems. Early variants of <span class="emphasis"><em>grep</em></span> included <span class="emphasis"><em>egrep</em></span> and <span class="emphasis"><em>fgrep</em></span>. The former applies an extended regular expression syntax that was added to Unix after Ken Thompson's original regular expression implementation. The latter searches for any of a list of 'fixed' strings using the Aho-Corasick algorithm. These variants are embodied in most modern <span class="emphasis"><em>grep</em></span> implementations as command-line switches (and standardized as -E and -F in POSIX). In such combined implementations, <span class="emphasis"><em>grep</em></span> may also behave differently depending on the name by which it is invoked, allowing <span class="emphasis"><em>fgrep</em></span>, <span class="emphasis"><em>egrep</em></span>, and <span class="emphasis"><em>grep</em></span> to be links to the same program.</p>
-<p id="ch9Using_Linux_Tools_1a3"><span class="emphasis"><em>pcregrep</em></span> is an implementation of <span class="emphasis"><em>grep</em></span> that uses Perl regular expression syntax.</p>
-<p id="ch9Using_Linux_Tools_1a4">Other commands contain the word 'grep' to indicate that they search (usually for regular expression matches). The <span class="emphasis"><em>pgrep</em></span> utility, for instance, displays the processes whose names match a given regular expression.</p>
-</div>
-</div>
-</div>
-<div class="section" title="13.2.tr">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2971438"></a>13.2.tr</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_1a5"><span class="emphasis"><em>tr</em></span> (abbreviated from <span class="emphasis"><em>translate</em></span> or <span class="emphasis"><em>transliterate</em></span>) is a command in Unix-like operating systems.</p>
-<p id="ch9Using_Linux_Tools_1a6">When executed, the program reads from the standard input and writes to the standard output. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set. For example,</p>
-<pre class="programlisting">
-$ tr 'abcd' 'jkmn'</pre>
-<p id="ch9Using_Linux_Tools_1a7">maps 'a' to 'j', 'b' to 'k', 'c' to 'm', and 'd' to 'n'.</p>
-<p id="ch9Using_Linux_Tools_1a8">Sets of characters may be abbreviated by using character ranges. The previous example could be written:</p>
-<pre class="programlisting">
-$ tr 'a-d' 'jkmn'</pre>
-<p id="ch9Using_Linux_Tools_1a9">In POSIX compliant versions of <span class="emphasis"><em>tr</em></span> the set represented by a character range depends on the locale's collating order, so it is safer to avoid character ranges in scripts that might be executed in a locale different from that in which they were written. Ranges can often be replaced with POSIX character sets such as [:alpha:].</p>
-<p id="ch9Using_Linux_Tools_1aa">The <span class="emphasis"><em>-c</em></span> flag complements the first set of characters.</p>
-<pre class="programlisting">
-$ tr -cd '[:alnum:]'</pre>
-<p id="ch9Using_Linux_Tools_1ab">therefore removes all non-alphanumeric characters.</p>
-<p id="ch9Using_Linux_Tools_1ac">The <span class="emphasis"><em>-s</em></span> flag causes tr to compress sequences of identical adjacent characters in its output to a single token. For example,</p>
-<pre class="programlisting">
-$ tr -s ' n' ' n'</pre>
-<p id="ch9Using_Linux_Tools_1ad">replaces sequences of one or more newline characters with a single newline.</p>
-<p id="ch9Using_Linux_Tools_1ae">The <span class="emphasis"><em>-d</em></span> flag causes tr to delete all tokens of the specified set of characters from its input. In this case, only a single character set argument is used. The following command removes carriage return characters, thereby converting a file in DOS/Windows format to one in Unix format.</p>
-<pre class="programlisting">
-$ tr -d ' r'</pre>
-<p id="ch9Using_Linux_Tools_1af">Most versions of <span class="emphasis"><em>tr</em></span>, including GNU <span class="emphasis"><em>tr</em></span> and classic Unix <span class="emphasis"><em>tr</em></span>, operate on single byte characters and are not Unicode compliant. An exception is the Heirloom Toolchest implementation, which provides basic Unicode support.</p>
-<p id="ch9Using_Linux_Tools_1b0">Ruby and Perl also have an internal <span class="emphasis"><em>tr</em></span> operator, which operates analogously. Tcl's <span class="emphasis"><em>string map</em></span> command is more general in that it maps strings to strings while <span class="emphasis"><em>tr</em></span> maps characters to characters.</p>
-</div>
-</div>
-<div class="section" title="14.Elementary Regex">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2971585"></a>14.Elementary Regex</h2></div></div></div>
-<p id="ch9Using_Linux_Tools_1b1">In computing, regular expressions provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters. A regular expression (often shortened to regex or regexp) is written in a formal language that can be interpreted by a regular expression processor, a program that either serves as a parser generator or examines text and identifies parts that match the provided specification.</p>
-<p id="ch9Using_Linux_Tools_1b2">Regular expressions are used by many text editors, utilities, and programming languages to search and manipulate text based on patterns. For example, Perl, Ruby and Tcl have a powerful regular expression engine built directly into their syntax. Several utilities provided by Unix distributionsincluding the editor <span class="emphasis"><em>ed</em></span> and the filter <span class="emphasis"><em>grep</em></span>  were the first to popularize the concept of regular expressions.</p>
-<p id="ch9Using_Linux_Tools_1b3">Traditional Unix regular expression syntax followed common conventions but often differed from tool to tool. The IEEE POSIX <span class="emphasis"><em>Basic Regular Expressions</em></span> (BRE) standard (released alongside an alternative flavor called Extended Regular Expressions or ERE) was designed mostly for backward compatibility with the traditional (Simple Regular Expression) syntax but provided a common standard which has since been adopted as the default syntax of many Unix regular expression tools, though there is often some variation or additional features. Many such tools also provide support for ERE syntax with command line arguments.</p>
-<p id="ch9Using_Linux_Tools_1b4">In the BRE syntax, most characters are treated as literals  they match only themselves (i.e., a matches "a"). The exceptions, listed below, are called metacharacters or metasequences.</p>
-<p id="ch9Using_Linux_Tools_1b5">Metacharacter</p>
-<p id="ch9Using_Linux_Tools_1b6">Description</p>
-<p id="ch9Using_Linux_Tools_1b7">.</p>
-<p id="ch9Using_Linux_Tools_1b8">Matches any single character (many applications exclude
-newlines, and exactly which characters are considered
-newlines is flavor, character encoding, and platform
-specific, but it is safe to assume that the line feed
-character is included). Within POSIX bracket expressions,
-the dot character matches a literal dot. For example, a.c
-matches abc, etc., but [a.c] matches only a, ., or
-c.</p>
-<p id="ch9Using_Linux_Tools_1b9">[ ]</p>
-<p id="ch9Using_Linux_Tools_1ba">A bracket expression. Matches a single character that is
-contained within the brackets. For example, [abc] matches
-a, b, or c. [a-z] specifies a range which matches any
-lowercase letter from a to z. These forms can be mixed:
-[abcx-z] matches a, b, c, x, y, or z, as does
-[a-cx-z]. The - character is treated as a literal character
-if it is the last or the first character within the
-brackets, or if it is escaped with a backslash: [abc-],
-[-abc], or [a-bc].</p>
-<p id="ch9Using_Linux_Tools_1bb">[^ ]</p>
-<p id="ch9Using_Linux_Tools_1bc">Matches a single character that is not contained within the
-brackets. For example, [^abc] matches any character other
-than a, b, or c. [^a-z] matches any single character
-that is not a lowercase letter from a to z. As above,
-literal characters and ranges can be mixed.</p>
-<p id="ch9Using_Linux_Tools_1bd">^</p>
-<p id="ch9Using_Linux_Tools_1be">Matches the starting position within the string. In
-line-based tools, it matches the starting position of any
-line.</p>
-<p id="ch9Using_Linux_Tools_1bf">$</p>
-<p id="ch9Using_Linux_Tools_1c0">Matches the ending position of the string or the position
-just before a string-ending newline. In line-based tools,
-it matches the ending position of any line.</p>
-<p id="ch9Using_Linux_Tools_1c1">*</p>
-<p id="ch9Using_Linux_Tools_1c2">Matches the preceding element zero or more times. For
-example, ab*c matches "ac", "abc", "abbbc", etc. [xyz]*
-matches "", "x", "y", "z", "zx", "zyx", "xyzzy", and so on.
-(ab)* matches "", "ab", "abab", "ababab", and so on.</p>
-<p id="ch9Using_Linux_Tools_1c3">?</p>
-<p id="ch9Using_Linux_Tools_1c4">Matches the preceding element zero or one time. For
-example, ba? matches "b" or "ba".</p>
-<p id="ch9Using_Linux_Tools_1c5">+</p>
-<p id="ch9Using_Linux_Tools_1c6">Matches the preceding element one or more times. For
-example, ba+ matches "ba", "baa", "baaa", and so on.</p>
-<p id="ch9Using_Linux_Tools_1c7">|</p>
-<p id="ch9Using_Linux_Tools_1c8">The choice (aka alternation or set union) operator matches
-either the expression before or the expression after the
-operator. For example, abc|def matches "abc" or "def".</p>
-<div class="section" title="14.1.Lazy quantification">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2971786"></a>14.1.Lazy quantification</h3></div></div></div>
-<p id="ch9Using_Linux_Tools_1c9">The standard quantifiers in regular expressions are greedy, meaning they match as much as they can, only giving back as necessary to match the remainder of the regex. For example, someone new to regexes wishing to find the first instance of an item between &lt; and &gt; symbols in this example:</p>
-<pre class="programlisting">
-Another whale explosion occurred on &lt;January 26&gt;, &lt;2004&gt;.</pre>
-<p id="ch9Using_Linux_Tools_1ca">...would likely come up with the pattern &lt;.*&gt;, or similar. However, this pattern will actually return "&lt;January 26&gt;, &lt;2004&gt;" instead of the "&lt;January 26&gt;" which might be expected, because the * quantifier is greedy  it will consume as many characters as possible from the input, and "January 26&gt;, &lt;2004" has more characters than "January 26".</p>
-<p id="ch9Using_Linux_Tools_1cb">Though this problem can be avoided in a number of ways (e.g., by specifying the text that is not to be matched: &lt;[^&gt;]*&gt;), modern regular expression tools allow a quantifier to be specified as <span class="emphasis"><em>lazy</em></span> (also known as non-greedy, reluctant, minimal, or ungreedy) by putting a question mark after the quantifier (e.g., &lt;.*?&gt;), or by using a modifier which reverses the greediness of quantifiers (though changing the meaning of the standard quantifiers can be confusing). By using a lazy quantifier, the expression tries the minimal match first. Though in the previous example lazy matching is used to select one of many matching results, in some cases it can also be used to improve performance when greedy matching would require more backtracking.</p>
-</div>
-</div>
-<div class="section" title="15.One Liners">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2971862"></a>15.One Liners</h2></div></div></div>
-<p id="ch9Using_Linux_Tools_1cc">A <span class="emphasis"><em>one-liner</em></span> is textual input to the command-line of an operating system shell that performs some function in just one line of input.</p>
-<p id="ch9Using_Linux_Tools_1cd">The one liner can be</p>
-<div class="orderedlist"><ol class="orderedlist" type="1">
-<li class="listitem"><p id="ch9Using_Linux_Tools_1ce">An expression written in the language of the shell.</p></li>
-<li class="listitem"><p id="ch9Using_Linux_Tools_1cf">The invocation of an interpreter together with program source for the interpreter to run.</p></li>
-<li class="listitem"><p id="ch9Using_Linux_Tools_1d0">The invocation of a compiler together with source to compile and
-instructions for executing the compiled program.</p></li>
-</ol></div>
-<p id="ch9Using_Linux_Tools_1d1">Certain dynamic scripting languages such as AWK, sed, and perl have traditionally been adept at expressing one-liners. Specialist shell interpreters such as these Unix shells or the Windows PowerShell, allow for the construction of powerful one-liners.</p>
-<p id="ch9Using_Linux_Tools_1d2">The use of the phrase one-liner has been widened to also include program-source for any language that does something useful in one line.</p>
-<p id="ch9Using_Linux_Tools_1d3">The word <span class="emphasis"><em>One-liner</em></span> has two references in the index of the book <span class="emphasis"><em>The AWK Programming Language</em></span> (the book is often referred to by the abbreviation TAPL). It explains the programming language AWK, which is part of the Unix operating system. The authors explain the birth of the One-liner paradigm with their daily work on early Unix machines:</p>
-<pre class="programlisting">
-The 1977 version had only a few built-in variables and predefined functions. It was designed for writing short programs [...] Our model was that an invocation would be one or two lines long, typed in and used immediately. Defaults were chosen to match this style [...] We, being the authors, knew how the language was supposed to be used, and so we only wrote one-liners.</pre>
-<p id="ch9Using_Linux_Tools_1d4">Notice that this original definition of a One-liner implies immediate execution of the program without any compilation. So, in a strict sense, only source code for interpreted languages qualifies as a One-liner. But this strict understanding of a One-liner was broadened in 1985 when the IOCCC introduced the category of Best One Liner for C, which is a compiled language.</p>
-<p id="ch9Using_Linux_Tools_1d5">The TAPL book contains 20 examples of One-liners (A Handful of Useful awk One-Liners) at the end of the book's first chapter.</p>
-<p id="ch9Using_Linux_Tools_1d6">Here are the first few of them:</p>
-<div class="orderedlist"><ol class="orderedlist" type="1">
-<li class="listitem">
-<p id="ch9Using_Linux_Tools_1d7">Print the total number of input lines:</p>
-<p id="ch9Using_Linux_Tools_1d8">END { print NR }</p>
-</li>
-<li class="listitem">
-<p id="ch9Using_Linux_Tools_1d9">Print the tenth input line:</p>
-<p id="ch9Using_Linux_Tools_1da">NR == 10</p>
-</li>
-<li class="listitem">
-<p id="ch9Using_Linux_Tools_1db">Print the last field of every input line:</p>
-<p id="ch9Using_Linux_Tools_1dc">{ print $NF }</p>
-</li>
-</ol></div>
-<p id="ch9Using_Linux_Tools_1dd">One-liners are also used to show off the differential expressive power of programming languages. Frequently, one-liners are used to demonstrate programming ability. Contests are often held to see who can create the most exceptional one-liner.</p>
-<p id="ch9Using_Linux_Tools_1de">The following example is a C program (a winning entry in the "Best one-liner" category of the IOCCC, here split to two lines for presentation).:</p>
-<pre class="programlisting">
-main(int c,char**v){return!m(v[1],v[2]);}m(char*s,char*t){return
-*t-42?*s?63==*t|*s==*t&amp;&amp;m(s+1,t+1):!*t:m(s,t+1)||*s&amp;&amp;m(s+1,t);}</pre>
-<p id="ch9Using_Linux_Tools_1df">This one-liner program is a <span class="emphasis"><em>glob pattern matcher</em></span>. It understands the glob characters '*' meaning 'zero or more characters' and '?' meaning exactly one character, just like most Unix shells.</p>
-<p id="ch9Using_Linux_Tools_1e0">Run it with two args, the string and the glob pattern. The exit status is 0 (shell true) when the pattern matches, 1 otherwise. The glob pattern must match the whole string, so you may want to use * at the beginning and end of the pattern if you are looking for something in the middle. Examples:</p>
-<pre class="programlisting">
-$ prog foo 'f??'; echo $?
-
-$ prog 'best short program' '??st*o**p?*'; echo $?</pre>
-<p id="ch9Using_Linux_Tools_1e1">Here is a one line shell script to show directories:</p>
-<pre class="programlisting">
-$ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^ /]* //--/g' -e 's/^/   /' -e 's/-/|/'</pre>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/chn10session4.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,436 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. session</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch10session4">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2773576"></a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2583667">1. More text processing</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2771691">1.1. <code class="literal">sort</code></a></span></dt>
-<dt><span class="section"><a href="#id2824598">1.2. <code class="literal">uniq</code></a></span></dt>
-<dt><span class="section"><a href="#id2824700">1.3. <code class="literal">join</code></a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2824800">2. Generating a word frequency list</a></span></dt>
-<dt><span class="section"><a href="#id2824947">3. Basic editing and editors</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2824956">3.1. vim</a></span></dt>
-<dt><span class="section"><a href="#id2825522">3.2. SciTE</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2825567">4. Personalizing your Environment</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2825576">4.1. .bashrc</a></span></dt>
-<dt><span class="section"><a href="#id2825876">4.2. .vimrc</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2826095">5. Subshells and <code class="literal">source</code></a></span></dt>
-</dl></dd>
-</dl>
-</div>
-<div class="article">
-<div class="titlepage">
-<div>
-<div><h2 class="title" id="id2773576"></h2></div>
-<div><h2 class="title" id="id2773576"></h2></div>
-</div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2583667">1. More text processing</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2771691">1.1. <code class="literal">sort</code></a></span></dt>
-<dt><span class="section"><a href="#id2824598">1.2. <code class="literal">uniq</code></a></span></dt>
-<dt><span class="section"><a href="#id2824700">1.3. <code class="literal">join</code></a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2824800">2. Generating a word frequency list</a></span></dt>
-<dt><span class="section"><a href="#id2824947">3. Basic editing and editors</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2824956">3.1. vim</a></span></dt>
-<dt><span class="section"><a href="#id2825522">3.2. SciTE</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2825567">4. Personalizing your Environment</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2825576">4.1. .bashrc</a></span></dt>
-<dt><span class="section"><a href="#id2825876">4.2. .vimrc</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2826095">5. Subshells and <code class="literal">source</code></a></span></dt>
-</dl>
-</div>
-<div class="section" title="1.More text processing">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2583667"></a>1.More text processing</h2></div></div></div>
-<div class="section" title="1.1.sort">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2771691"></a>1.1.<code class="literal">sort</code>
-</h3></div></div></div>
-<p id="ch10session4_1">Let's say we have a file which lists a few of the stalwarts of the open source community and a few details about them, like their "other" name, their homepage address, and what they are well known for or their claim to fame.</p>
-<pre class="programlisting">
-Richard Stallman%rms%GNU Project
-Eric Raymond%ESR%Jargon File
-Ian Murdock% %Debian
-Lawrence Lessig% %Creative Commons
-Linus Torvalds% %Linux Kernel
-Guido van Rossum%BDFL%Python
-Larry Wall% %Perl</pre>
-<p id="ch10session4_2">The sort command enables us to do this in a flash! Just running the sort command with the file name as a parameter sorts the lines of the file alphabetically and prints the output on the terminal.</p>
-<pre class="programlisting">
-$ sort stalwarts.txt
-Eric Raymond%ESR%Jargon File
-Guido van Rossum%BDFL%Python
-Ian Murdock% %Debian
-Larry Wall% %Perl
-Lawrence Lessig% %Creative Commons
-Linus Torvalds% %Linux Kernel
-Richard Stallman%rms%GNU Project</pre>
-<p id="ch10session4_3">If you wish to sort them reverse alphabetically, you just need to pass the <code class="literal">-r</code> option. Now, you might want to sort the lines, based on each person's claim to fame or their "other" name. What do we do in that case?</p>
-<p id="ch10session4_4">Below is an example that sorts the file based on "other" names.</p>
-<pre class="programlisting">
-$ sort -t % -k 2,2  stalwarts.txt
-
-Ian Murdock% %Debian
-Larry Wall% %Perl
-Lawrence Lessig% %Creative Commons
-Linus Torvalds% %Linux Kernel
-Guido van Rossum%BDFL%Python
-Eric Raymond%ESR%Jargon File
-Richard Stallman%rms%GNU Project</pre>
-<p id="ch10session4_5">Sort command assumes white space to be the default delimiter for columns in each line. The <code class="literal">-t</code> option specifies the delimiting character, which is <code class="literal">%</code> in this case.</p>
-<p id="ch10session4_6">The <code class="literal">-k</code> option starts a key at position 2 and ends it at 2, essentially telling the sort command that it should sort based on the 2nd column, which is the other name. <code class="literal">sort</code> also supports conflict resolution using multiple columns for sorting. You can see that the first three lines have nothing in the "other" names column. We could resolve the conflict by sorting based on the project names (the 3rd column).</p>
-<pre class="programlisting">
-$ sort -t % -k 2,2 -k 3,3  stalwarts.txt
-
-Lawrence Lessig% %Creative Commons
-Ian Murdock% %Debian
-Linus Torvalds% %Linux Kernel
-Larry Wall% %Perl
-Guido van Rossum%BDFL%Python
-Eric Raymond%ESR%Jargon File
-Richard Stallman%rms%GNU Project</pre>
-<p id="ch10session4_7"><code class="literal">sort</code> also has a lot of other options like ignoring case differences, month sort(JAN&lt;FEB&lt;...), merging already sorted files. <code class="literal">man sort</code> would give you a lot of information.</p>
-</div>
-<div class="section" title="1.2.uniq">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2824598"></a>1.2.<code class="literal">uniq</code>
-</h3></div></div></div>
-<p id="ch10session4_8">Suppose we have a list of items, say books, and we wish to obtain a list which names of all the books only once, without any duplicates. We use the <code class="literal">uniq</code> command to achieve this.</p>
-<pre class="programlisting">
-Programming Pearls
-The C Programming Language
-The Mythical Man Month: Essays on Software Engineering
-Programming Pearls
-The C Programming Language
-Structure and Interpretation of Computer Programs
-Programming Pearls
-Compilers: Principles, Techniques, and Tools
-The C Programming Language
-The Art of UNIX Programming
-Programming Pearls
-The Art of Computer Programming
-Introduction to Algorithms
-The Art of UNIX Programming
-The Pragmatic Programmer: From Journeyman to Master
-Programming Pearls
-Unix Power Tools
-The Art of UNIX Programming</pre>
-<p id="ch10session4_9">Let us try and get rid of the duplicate lines from this file using the <code class="literal">uniq</code> command.</p>
-<pre class="programlisting">
-$ uniq items.txt
-Programming Pearls
-The C Programming Language
-The Mythical Man Month: Essays on Software Engineering
-Programming Pearls
-The C Programming Language
-Structure and Interpretation of Computer Programs
-Programming Pearls
-Compilers: Principles, Techniques, and Tools
-The C Programming Language
-The Art of UNIX Programming
-Programming Pearls
-The Art of Computer Programming
-Introduction to Algorithms
-The Art of UNIX Programming
-The Pragmatic Programmer: From Journeyman to Master
-Programming Pearls
-Unix Power Tools
-The Art of UNIX Programming</pre>
-<p id="ch10session4_a">Nothing happens! Why? The <code class="literal">uniq</code> command removes duplicate lines only when they are next to each other. So, we get a sorted file from the original file and work with that file, henceforth.</p>
-<pre class="programlisting">
-$ sort items.txt &gt; items-sorted.txt
-$ uniq items-sorted.txt
-Compilers: Principles, Techniques, and Tools
-Introduction to Algorithms
-Programming Pearls
-Structure and Interpretation of Computer Programs
-The Art of Computer Programming
-The Art of UNIX Programming
-The C Programming Language
-The Mythical Man Month: Essays on Software Engineering
-The Pragmatic Programmer: From Journeyman to Master
-Unix Power Tools</pre>
-<p id="ch10session4_b"><code class="literal">uniq -u</code> command gives the lines which are unique and do not have any duplicates in the file. <code class="literal">uniq -d</code> outputs only those lines which have duplicates. The <code class="literal">-c</code> option displays the number of times each line occurs in the file.</p>
-<pre class="programlisting">
-$ uniq -u items-sorted.txt
-Compilers: Principles, Techniques, and Tools
-Introduction to Algorithms
-Structure and Interpretation of Computer Programs
-The Art of Computer Programming
-The Mythical Man Month: Essays on Software Engineering
-The Pragmatic Programmer: From Journeyman to Master
-Unix Power Tools
-
-$ uniq -dc items-sorted.txt
-5 Programming Pearls
-3 The Art of UNIX Programming
-3 The C Programming Language</pre>
-</div>
-<div class="section" title="1.3.join">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2824700"></a>1.3.<code class="literal">join</code>
-</h3></div></div></div>
-<p id="ch10session4_c">Now suppose we had the file <code class="literal">stalwarts1.txt</code>, which lists the home pages of all the people listed in <code class="literal">stalwarts.txt</code>.</p>
-<pre class="programlisting">
-Richard Stallman%http://www.stallman.org
-Eric Raymond%http://www.catb.org/~esr/
-Ian Murdock%http://ianmurdock.com/
-Lawrence Lessig%http://lessig.org
-Linus Torvalds%http://torvalds-family.blogspot.com/
-Guido van Rossum%http://www.python.org/~guido/
-Larry Wall%http://www.wall.org/~larry/</pre>
-<p id="ch10session4_d">It would be nice to have a single file with the information in both the files. To achieve this we use the <code class="literal">join</code> command.</p>
-<pre class="programlisting">
-$ join stalwarts.txt stalwarts1.txt -t %
-Richard Stallman%rms%GNU Project%http://www.stallman.org
-Eric Raymond%ESR%Jargon File%http://www.catb.org/~esr/
-Ian Murdock% %Debian%http://ianmurdock.com/
-Lawrence Lessig% %Creative Commons%http://lessig.org
-Linus Torvalds% %Linux Kernel%http://torvalds-family.blogspot.com/
-Guido van Rossum%BDFL%Python%http://www.python.org/~guido/
-Larry Wall% %Perl%http://www.wall.org/~larry/</pre>
-<p id="ch10session4_e">The <code class="literal">join</code> command joins the two files, based on the common field present in both the files, which is the name, in this case.</p>
-<p id="ch10session4_f">The <code class="literal">-t</code> option again specifies the delimiting character. Unless that is specified, join assumes that the fields are separated by spaces.</p>
-<p id="ch10session4_10">Note that, for <code class="literal">join</code> to work, the common field should be in the same order in both the files. If this is not so, you could use <code class="literal">sort</code>, to sort the files on the common field and then join the files. In the above example, we have the common field to be the first column in both the files. If this is not the case we could use the <code class="literal">-1</code> and <code class="literal">-2</code> options to specify the field to be used for joining the files.</p>
-<pre class="programlisting">
-$ join -2 2 stalwarts.txt stalwarts2.txt -t %
-Richard Stallman%rms%GNU Project%http://www.stallman.org
-Eric Raymond%ESR%Jargon File%http://www.catb.org/~esr/
-Ian Murdock% %Debian%http://ianmurdock.com/
-Lawrence Lessig% %Creative Commons%http://lessig.org
-Linus Torvalds% %Linux Kernel%http://torvalds-family.blogspot.com/
-Guido van Rossum%BDFL%Python%http://www.python.org/~guido/
-Larry Wall% %Perl%http://www.wall.org/~larry/</pre>
-</div>
-</div>
-<div class="section" title="2.Generating a word frequency list">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2824800"></a>2.Generating a word frequency list</h2></div></div></div>
-<p id="ch10session4_11">Now, let us use the tools we have learnt to use, to generate a word frequency list of a text file. We shall use the free text of Alice in Wonderland.</p>
-<p id="ch10session4_12">The basic steps to achieve this task would be -</p>
-<div class="orderedlist"><ol class="orderedlist" type="1">
-<li class="listitem"><p id="ch10session4_13">Eliminate the punctuation and spaces from the document.</p></li>
-<li class="listitem"><p id="ch10session4_14">Generate a list of words.</p></li>
-<li class="listitem"><p id="ch10session4_15">Count the words.</p></li>
-</ol></div>
-<p id="ch10session4_16">We first use <code class="literal">grep</code> and some elementary <code class="literal">regex</code> to eliminate the non-alpha-characters.</p>
-<pre class="programlisting">
-$ grep "[A-Za-z]*" alice-in-wonderland.txt</pre>
-<p id="ch10session4_17">This outputs all the lines which has any alphabetic characters on it. This isn't of much use, since we haven't done anything with the code. We only require the alphabetic characters, without any of the other junk. <code class="literal">man grep</code> shows us the <code class="literal">-o</code> option for outputting only the text which matches the regular expression.</p>
-<pre class="programlisting">
-$ grep "[A-Za-z]*" -o alice-in-wonderland.txt</pre>
-<p id="ch10session4_18">Not very surprisingly, we have all the words, spit out in the form of a list! Now that we have a list of words, it is quite simple to count the occurrences of the words. You would've realized that we can make use of <code class="literal">sort</code> and <code class="literal">uniq</code> commands. We pipe the output from the <code class="literal">grep</code> to the <code class="literal">sort</code> and then pipe it's output to <code class="literal">uniq</code>.</p>
-<pre class="programlisting">
-$ grep "[A-Za-z]*" -o alice-in-wonderland.txt | sort | uniq -c</pre>
-<p id="ch10session4_19">Notice that you get the list of all words in the document in the alphabetical order, with it's frequency written next to it. But, you might have observed that Capitalized words and lower case words are being counted as different words. We therefore, replace all the Upper case characters with lower case ones, using the <code class="literal">tr</code> command.</p>
-<pre class="programlisting">
-$ grep  "[A-Za-z]*" -o alice-in-wonderland.txt | tr 'A-Z' 'a-z' | sort | uniq -c</pre>
-<p id="ch10session4_1a">Now, it would also be nice to have the list ordered in the decreasing order of the frequency of the appearance of the words. We sort the output of the <code class="literal">uniq</code> command with <code class="literal">-n</code> and <code class="literal">-r</code> options, to get the desired output.</p>
-<pre class="programlisting">
-$ grep  "[A-Za-z]*" -o alice-in-wonderland.txt | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr</pre>
-</div>
-<div class="section" title="3.Basic editing and editors">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2824947"></a>3.Basic editing and editors</h2></div></div></div>
-<div class="section" title="3.1.vim">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2824956"></a>3.1.vim</h3></div></div></div>
-<p id="ch10session4_1b">Vim is a very powerful editor. It has a lot of commands, and all of them cannot be explained here. We shall try and look at a few, so that you can find your way around in vim.</p>
-<p id="ch10session4_1c">To open a file in vim, we pass the filename as a parameter to the <code class="literal">vim</code> command. If a file with that filename does not exist, a new file is created.</p>
-<pre class="programlisting">
-$ vim first.txt</pre>
-<p id="ch10session4_1d">To start inserting text into the new file that we have opened, we need to press the <code class="literal">i</code> key. This will take us into the <span class="emphasis"><em>insert</em></span> mode from the <span class="emphasis"><em>command</em></span> mode. Hitting the <code class="literal">esc</code> key, will bring us back to the <span class="emphasis"><em>command</em></span> mode. There is also another mode of vim, called the <span class="emphasis"><em>visual</em></span> mode which will be discussed later in the course.</p>
-<p id="ch10session4_1e">In general, it is good to spend as little time as possible in the insert mode and extensively use the command mode to achieve various tasks.</p>
-<p id="ch10session4_1f">To save the file, use <code class="literal">:w</code> in the command mode. From here on, it is understood that we are in the command mode, whenever we are issuing any command to vim.</p>
-<p id="ch10session4_20">To save a file and continue editing, use <code class="literal">:w FILENAME</code>
-The file name is optional. If you do not specify a filename, it is saved in the same file that you opened. If a file name different from the one you opened is specified, the text is saved with the new name, but you continue editing the file that you opened. The next time you save it without specifying a name, it gets saved with the name of the file that you initially opened.</p>
-<p id="ch10session4_21">To save file with a new name and continue editing the new file, use <code class="literal">:saveas FILENAME</code></p>
-<p id="ch10session4_22">To save and quit, use <code class="literal">:wq</code></p>
-<p id="ch10session4_23">To quit, use <code class="literal">:q</code></p>
-<p id="ch10session4_24">To quit without saving, use <code class="literal">:q!</code></p>
-<div class="section" title="3.1.1.Moving around">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2825077"></a>3.1.1.Moving around</h4></div></div></div>
-<p id="ch10session4_25">While you are typing in a file, it is in-convenient to keep moving your fingers from the standard position for typing to the arrow keys. Vim, therefore, provides alternate keys for moving in the document. Note again that, you should be in the command mode, when issuing any commands to vim.</p>
-<p id="ch10session4_26">The basic cursor movement can be achieved using the keys, <code class="literal">h</code> (left), <code class="literal">l</code> (right), <code class="literal">k</code> (up) and <code class="literal">j</code> (down).</p>
-<pre class="programlisting">
-      ^
-      k
-&lt; h       l &gt;
-      j
-      v</pre>
-<p id="ch10session4_27">Note: Most commands can be prefixed with a number, to repeat the command. For instance, <code class="literal">10j</code> will move the cursor down 10 lines.</p>
-<div class="section" title="3.1.1.1.Moving within a line">
-<div class="titlepage"><div><div><h5 class="title">
-<a name="id2825129"></a>3.1.1.1.Moving within a line</h5></div></div></div>
-<p id="ch10session4_28">Cursor Movement</p>
-<p id="ch10session4_29">Command</p>
-<p id="ch10session4_2a">Forward by a screenful of text</p>
-<p id="ch10session4_2b"><code class="literal">C-f</code></p>
-<p id="ch10session4_2c">Backward by a screenful of text</p>
-<p id="ch10session4_2d"><code class="literal">C-b</code></p>
-<p id="ch10session4_2e">Beginning of the screen</p>
-<p id="ch10session4_2f"><code class="literal">H</code></p>
-<p id="ch10session4_30">Middle of the screen</p>
-<p id="ch10session4_31"><code class="literal">M</code></p>
-<p id="ch10session4_32">End of the screen</p>
-<p id="ch10session4_33"><code class="literal">L</code></p>
-<p id="ch10session4_34">End of file</p>
-<p id="ch10session4_35"><code class="literal">G</code></p>
-<p id="ch10session4_36">Line number <code class="literal">num</code></p>
-<p id="ch10session4_37"><code class="literal">[num]G</code></p>
-<p id="ch10session4_38">Beginning of file</p>
-<p id="ch10session4_39"><code class="literal">gg</code></p>
-<p id="ch10session4_3a">Next occurrence of the text
-under the cursor</p>
-<p id="ch10session4_3b"><code class="literal">*</code></p>
-<p id="ch10session4_3c">Previous occurrence of the text
-under the cursor</p>
-<p id="ch10session4_3d"><code class="literal">#</code></p>
-<p id="ch10session4_3e">Note: <code class="literal">C-x</code> is <code class="literal">Ctrl</code> + <code class="literal">x</code></p>
-</div>
-</div>
-<div class="section" title="3.1.2.The visual mode">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2825272"></a>3.1.2.The visual mode</h4></div></div></div>
-<p id="ch10session4_3f">The visual mode is a special mode that is not present in the original vi editor. It allows us to highlight text and perform actions on it. All the movement commands that have been discussed till now work in the visual mode also. The editing commands that will be discussed in the future work on the visual blocks selected, too.</p>
-</div>
-<div class="section" title="3.1.3.Editing commands">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2825290"></a>3.1.3.Editing commands</h4></div></div></div>
-<p id="ch10session4_40">The editing commands usually take the movements as arguments. A movement is equivalent to a selection in the visual mode. The cursor is assumed to have moved over the text in between the initial and the final points of the movement. The motion or the visual block that's been highlighted can be passed as arguments to the editing commands.</p>
-<p id="ch10session4_41">Editing effect</p>
-<p id="ch10session4_42">Command</p>
-<p id="ch10session4_43">Cut the character under the cursor</p>
-<p id="ch10session4_44"><code class="literal">x</code></p>
-<p id="ch10session4_45">Replace the character under the
-cursor with <code class="literal">a</code></p>
-<p id="ch10session4_46"><code class="literal">ra</code></p>
-<p id="ch10session4_47">Cut an entire line</p>
-<p id="ch10session4_48"><code class="literal">dd</code></p>
-<p id="ch10session4_49">Copy/yank an entire line</p>
-<p id="ch10session4_4a"><code class="literal">yy</code></p>
-<p id="ch10session4_4b">Note: You can prefix numbers to any of the commands, to repeat them.</p>
-</div>
-<div class="section" title="3.1.4.Undo and Redo">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2825370"></a>3.1.4.Undo and Redo</h4></div></div></div>
-<p id="ch10session4_4c">You can undo almost anything using <code class="literal">u</code>.</p>
-<p id="ch10session4_4d">To undo the undo command type <code class="literal">C-r</code></p>
-</div>
-<div class="section" title="3.1.5.Searching and Replacing">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2825395"></a>3.1.5.Searching and Replacing</h4></div></div></div>
-<p id="ch10session4_4e">Finding and Replacing</p>
-<p id="ch10session4_4f">Command</p>
-<p id="ch10session4_50">Replace the first instance of <code class="literal">old</code>
-with <code class="literal">new</code> in the current line.</p>
-<p id="ch10session4_51"><code class="literal">:s/old/new</code></p>
-<p id="ch10session4_52">Replace all instances of <code class="literal">old</code>
-with <code class="literal">new</code> in the current line.</p>
-<p id="ch10session4_53"><code class="literal">:s/old/new/g</code></p>
-<p id="ch10session4_54">Replace all instances of <code class="literal">old</code>
-with <code class="literal">new</code> in the current line,
-but ask for confirmation each time.</p>
-<p id="ch10session4_55"><code class="literal">:s/old/new/gc</code></p>
-<p id="ch10session4_56">Replace the first instance of <code class="literal">old</code>
-with <code class="literal">new</code> in the entire file.</p>
-<p id="ch10session4_57"><code class="literal">:%s/old/new</code></p>
-<p id="ch10session4_58">Replace all instances of <code class="literal">old</code>
-with <code class="literal">new</code> in the entire file.</p>
-<p id="ch10session4_59"><code class="literal">:%s/old/new/g</code></p>
-<p id="ch10session4_5a">Replace all instances of <code class="literal">old</code> with
-<code class="literal">new</code> in the entire file but ask
-for confirmation each time.</p>
-<p id="ch10session4_5b"><code class="literal">:%s/old/new/gc</code></p>
-</div>
-</div>
-<div class="section" title="3.2.SciTE">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2825522"></a>3.2.SciTE</h3></div></div></div>
-<p id="ch10session4_5c">SciTE is a <span class="emphasis"><em>source code</em></span> editor, that has a feel similar to the commonly used GUI text editors. It has a wide range of features that are extremely useful for a programmer, editing code. Also it aims to keep configuration simple, and the user needs to edit a text file to configure SciTE to his/her liking.</p>
-<p id="ch10session4_5d">Opening, Saving, Editing files with SciTE is extremely simple and trivial. Knowledge of using a text editor will suffice.</p>
-<p id="ch10session4_5e">SciTE can syntax highlight code in various languages. It also has auto-indentation, code-folding and other such features which are useful when editing code.</p>
-<p id="ch10session4_5f">SciTE also gives you the option to (compile and) run your code, from within the editor.</p>
-</div>
-</div>
-<div class="section" title="4.Personalizing your Environment">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2825567"></a>4.Personalizing your Environment</h2></div></div></div>
-<div class="section" title="4.1..bashrc">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2825576"></a>4.1..bashrc</h3></div></div></div>
-<p id="ch10session4_60">What would you do, if you want bash to execute a particular command each time you start it up? For instance, say you want the current directory to be your Desktop instead of your home folder, each time bash starts up. How would you achieve this? Bash reads and executes commands in a whole bunch of files called start-up files, when it starts up.</p>
-<p id="ch10session4_61">When bash starts up as an interactive login shell, it reads the files <code class="literal">/etc/profile</code>, <code class="literal">~/.bash_profile</code>, <code class="literal">~/.bash_login</code>, and <code class="literal">~/.profile</code> in that order.</p>
-<p id="ch10session4_62">When it is a shell that is not a login shell, <code class="literal">~/.bashrc</code> is read and the commands in it are executed. This can be prevented using the <code class="literal">--norc</code> option. To force bash to use another file, instead of the <code class="literal">~/.bashrc</code> file on start-up, the <code class="literal">--rcfile</code> option may be used.</p>
-<p id="ch10session4_63">Now, you know what you should do, to change the current directory to you Desktop. Just put a <code class="literal">cd ~/Desktop</code> into your <code class="literal">~/.bashrc</code> and you are set!</p>
-<p id="ch10session4_64">This example is quite a simple and lame one. The start-up files are used for a lot more complex things than this. You could set (or unset) aliases and a whole bunch of environment variables in the <code class="literal">.bashrc</code>. We shall look at them, in the next section where we look at environment variables and <code class="literal">set</code> command.</p>
-</div>
-<div class="section" title="4.2..vimrc">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2825876"></a>4.2..vimrc</h3></div></div></div>
-<p id="ch10session4_65"><code class="literal">.vimrc</code> is a file similar to <code class="literal">.bashrc</code> for vim. It is a start-up file that vim reads and executes, each time it starts up. The options that you would like to be set every time you use vim, are placed in the <code class="literal">.vimrc</code> file, so that they are automatically set each time vim starts. The recommended place for having your <code class="literal">.vimrc</code> is also your home directory.</p>
-<p id="ch10session4_66">The file <code class="literal">/etc/vimrc</code> is the global config file and shouldn't usually be edited. You can instead edit the <code class="literal">~/.vimrc</code> file that is present in your home folder.</p>
-<p id="ch10session4_67">There are a whole bunch of variables that you could set in the <code class="literal">.vimrc</code> file. You can look at all the options available, using the <code class="literal">:set all</code> command in vim. You could use the <code class="literal">:help option_name</code> to get more information about the option that you want to set. Once you are comfortable with what you want to set a particular variable to, you could add it to <code class="literal">.vimrc</code>. You should also look at <code class="literal">:help vimrc</code> for more info on the <code class="literal">.vimrc</code> file. If you already have a <code class="literal">.vimrc</code> file, you can edit it from within vim, using <code class="literal">:e $MYVIMRC</code> command. We shall look at some of the most commonly used options.</p>
-<p id="ch10session4_68">Command</p>
-<p id="ch10session4_69">Vim action</p>
-<p id="ch10session4_6a"><code class="literal">set nocompatible</code></p>
-<p id="ch10session4_6b">Explicitly disable compatibility with vi</p>
-<p id="ch10session4_6c"><code class="literal">set backspace=indent,eol,start</code></p>
-<p id="ch10session4_6d">In the insert mode, vim allows the backspace key to delete white spaces at the
-start of line, line breaks and the character before which insert mode started.</p>
-<p id="ch10session4_6e">set autoindent</p>
-<p id="ch10session4_6f">Vim indents a new line with the same indentation of the previous line.</p>
-<p id="ch10session4_70">set backup</p>
-<p id="ch10session4_71">Vim keeps a backup copy of a file when overwriting it.</p>
-<p id="ch10session4_72">set history=50</p>
-<p id="ch10session4_73">Vim keeps 50 commands and 50 search patterns in the history.</p>
-<p id="ch10session4_74">set ruler</p>
-<p id="ch10session4_75">Displays the current cursor position in the lower right corner of the vim window.</p>
-<p id="ch10session4_76">set showcmd</p>
-<p id="ch10session4_77">Displays the incomplete command in the lower right corner.</p>
-<p id="ch10session4_78">set incsearch</p>
-<p id="ch10session4_79">Turns on incremental searching. Displays search results while you type.</p>
-<p id="ch10session4_7a">You can see the effect of the changes made to your <code class="literal">.vimrc</code> file by restarting vim. If you want to see the changes that you made to your <code class="literal">.vimrc</code> file immediately, you could source the file from within vim.</p>If the <code class="literal">.vimrc</code> file has been sourced when this instance of vim was started, you could just resource the file again::<p id="ch10session4_7b">:so $MYVIMRC</p>
-<p id="ch10session4_7c">If you just created the <code class="literal">.vimrc</code> file or it was not sourced when you stared this instance of vim, just replace the <code class="literal">$MYVIMRC</code> variable above, with the location of the <code class="literal">.vimrc</code> file that you created/edited.</p>
-</div>
-</div>
-<div class="section" title="5.Subshells and source">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2826095"></a>5.Subshells and <code class="literal">source</code>
-</h2></div></div></div>
-<p id="ch10session4_7d">A subshell is just a separate instance of the shell which is a child process of the shell that launches it. Bash creates a subshell in various circumstances. Creation of subshells allows the execution of various processes simultaneously.</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch10session4_7e">When an external command is executed, a new subshell is created. Any built-in commands of bash are executed with int the same shell, and no new subshell is started. When an external command is run, the bash shell copies itself (along with it's environment) creating a subshell and the process is changed to the external command executed. The subshell is a child process of this shell.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch10session4_7f">Any pipes being used, create a subshell. The commands on the input and output ends of the pipe are run in different subshells.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch10session4_80">You could also, explicitly tell bash to start a subshell by enclosing a list of commands between parentheses. Each of the commands in the list is executed within a single new subshell.</p></li>
-</ul></div>
-<p id="ch10session4_81">To avoid creating a subshell, when running a shell script, you could use the <code class="literal">source</code> command.</p>
-<pre class="programlisting">
-$ source script.sh</pre>
-<p id="ch10session4_82">This will run the <code class="literal">script.sh</code> within the present shell without creating a subshell. The <code class="literal">.</code> command is an alias for the source command. <code class="literal">. script.sh</code> is therefore equivalent to <code class="literal">source script.sh</code>.</p>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/chn11Section_5.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,782 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. Section_</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch11Section_5">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="article"><a href="#id2647624"></a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2457715">1. Module Objectives:</a></span></dt>
-<dt><span class="section"><a href="#id2645976">2. tar:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2646529">2.1. Introduction:</a></span></dt>
-<dt><span class="section"><a href="#id2698596">2.2. Getting Started(go go go!):</a></span></dt>
-<dt><span class="section"><a href="#id2698875">2.3. Further Reading for this section:</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2698920">3. GZip:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2698946">3.1. Get going:</a></span></dt>
-<dt><span class="section"><a href="#id2699199">3.2. Further Reading for this section:</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2699253">4. File Comparisons:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2699270">4.1. cmp:</a></span></dt>
-<dt><span class="section"><a href="#id2699312">4.2. diff:</a></span></dt>
-<dt><span class="section"><a href="#id2699394">4.3. comm:</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2699424">5. Environment Variables:</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2699524">5.1. Further Reading:</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2699578">6. Shell Scripting:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2699586">6.1. Basics:</a></span></dt>
-<dt><span class="section"><a href="#id2697944">6.2. Shell Arithmetic:</a></span></dt>
-<dt><span class="section"><a href="#id2699963">6.3. if else construct:</a></span></dt>
-<dt><span class="section"><a href="#id2700069">6.4. Loops</a></span></dt>
-<dt><span class="section"><a href="#id2700315">6.5. Functions</a></span></dt>
-<dt><span class="section"><a href="#id2700386">6.6. Further Reading:</a></span></dt>
-</dl></dd>
-</dl></dd>
-</dl>
-</div>
-<div class="article">
-<div class="titlepage">
-<div>
-<div><h2 class="title" id="id2647624"></h2></div>
-<div><h2 class="title" id="id2647624"></h2></div>
-</div>
-<hr />
-</div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl>
-<dt><span class="section"><a href="#id2457715">1. Module Objectives:</a></span></dt>
-<dt><span class="section"><a href="#id2645976">2. tar:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2646529">2.1. Introduction:</a></span></dt>
-<dt><span class="section"><a href="#id2698596">2.2. Getting Started(go go go!):</a></span></dt>
-<dt><span class="section"><a href="#id2698875">2.3. Further Reading for this section:</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2698920">3. GZip:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2698946">3.1. Get going:</a></span></dt>
-<dt><span class="section"><a href="#id2699199">3.2. Further Reading for this section:</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2699253">4. File Comparisons:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2699270">4.1. cmp:</a></span></dt>
-<dt><span class="section"><a href="#id2699312">4.2. diff:</a></span></dt>
-<dt><span class="section"><a href="#id2699394">4.3. comm:</a></span></dt>
-</dl></dd>
-<dt><span class="section"><a href="#id2699424">5. Environment Variables:</a></span></dt>
-<dd><dl><dt><span class="section"><a href="#id2699524">5.1. Further Reading:</a></span></dt></dl></dd>
-<dt><span class="section"><a href="#id2699578">6. Shell Scripting:</a></span></dt>
-<dd><dl>
-<dt><span class="section"><a href="#id2699586">6.1. Basics:</a></span></dt>
-<dt><span class="section"><a href="#id2697944">6.2. Shell Arithmetic:</a></span></dt>
-<dt><span class="section"><a href="#id2699963">6.3. if else construct:</a></span></dt>
-<dt><span class="section"><a href="#id2700069">6.4. Loops</a></span></dt>
-<dt><span class="section"><a href="#id2700315">6.5. Functions</a></span></dt>
-<dt><span class="section"><a href="#id2700386">6.6. Further Reading:</a></span></dt>
-</dl></dd>
-</dl>
-</div>
-<div class="section" title="1.Module Objectives:">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2457715"></a>1.Module Objectives:</h2></div></div></div>
-<p id="ch11Section_5_1">After successfully completing this module a participant will be able to:</p>
-<pre class="programlisting">
-- Understand
-  * What are archives and zipped files                              U
-  * What are environment variables                                  U
-  * What are Shell Scripts                                          U
-- Able to use file comparison commands like                         Ap
-  diff, cmp, comm
-- Create and extract archives(.tar files) and zipped files(.gz)     Ap
-- Set/Modify environment as per need                                Ap
-- Create shell scripts to automate tasks.                           Ap</pre>
-</div>
-<div class="section" title="2.tar:">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2645976"></a>2.tar:</h2></div></div></div>
-<div class="section" title="2.1.Introduction:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2646529"></a>2.1.Introduction:</h3></div></div></div>
-<p id="ch11Section_5_2">In world of Linux based distribution, <span class="emphasis"><em>tarballs</em></span> is the term which pops up very often. It is part of the GNU project and comes as part of every distribution of GNU/Linux. Tarball is like defacto standard for releasing source code for free software. Some of common use of <span class="emphasis"><em>tar</em></span> archives is to: <span class="emphasis"><em>Store, backup, and transport</em></span>.</p>
-<p id="ch11Section_5_3">GNU tar creates and manipulates archives which are actually collections of many other files; the program provides users with an organized and systematic method for controlling a large amount of data. It is basically form of creating archive by concatenating one or more files.</p>
-</div>
-<div class="section" title="2.2.Getting Started(go go go!):">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2698596"></a>2.2.Getting Started(go go go!):</h3></div></div></div>
-<p id="ch11Section_5_4">As mentioned previously and if not, <span class="emphasis"><em>The best way to get started with any command line tool of Linux is to use "man".</em></span></p>
-<pre class="programlisting">
-$ man tar</pre>
-<p id="ch11Section_5_5">or try these commands(the output may vary with different installations):</p>
-<pre class="programlisting">
-$ tar --version
-tar (GNU tar) 1.20
-Copyright (C) 2008 Free Software Foundation, Inc.
-License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.
-
-Written by John Gilmore and Jay Fenlason.
-
-$ tar --help
-Usage: tar [OPTION...] [FILE]...
-GNU `tar' saves many files together into a single tape or disk archive, and can
-restore individual files from the archive.
-Examples:
-tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
-tar -tvf archive.tar         # List all files in archive.tar verbosely.
-tar -xf archive.tar          # Extract all files from archive.tar.
-____________</pre>
-<div class="section" title="2.2.1.Creating a tar archive:">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2698650"></a>2.2.1.Creating a tar archive:</h4></div></div></div>
-<p id="ch11Section_5_6">We will do some off-the road activity for this exercise. We will use an interesting command <span class="emphasis"><em>fortune</em></span> for creating our practice files and then performing archives of those files and directories. Content of the files would vary for users, as fortune works like that.</p>
-<pre class="programlisting">
-$ mkdir fortune-files
-$ cd fortune-files/
-$ fortune &gt; first.txt
-$ cat first.txt
-Expect the worst, it's the least you can do.
-$ fortune &gt; second.txt
-$ fortune &gt; third.txt
-$ ls
-first.txt  second.txt  third.txt</pre>
-<p id="ch11Section_5_7">By now we have three txt files, with some random fortune content. To create a tar archive of these files we can use any of following commands according to ones convenience:</p>
-<pre class="programlisting">
-$ tar --create --verbose --file=allfiles.tar first.txt second.txt third.txt
-first.txt
-second.txt
-third.txt
-$ ls
-allfiles.tar  first.txt  second.txt  third.txt</pre>
-<p id="ch11Section_5_8">allfiles.tar is our required tar archive of all the rest of files(or archive of files mentioned in command line). Other form of the previous command are:</p>
-<pre class="programlisting">
-$ tar -c -v -f allfiles.tar first.txt second.txt third.txt</pre>
-<p id="ch11Section_5_9">or</p>
-<pre class="programlisting">
-$ tar -cvf allfiles.tar first.txt second.txt third.txt</pre>
-<p id="ch11Section_5_a">The general format for creating a tar archive is:</p>
-<pre class="programlisting">
-tar [OPTION...] [FILE]...</pre>
-<p id="ch11Section_5_b">For our command are using these options:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch11Section_5_c">-c to Create the archive.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch11Section_5_d">-v for Verbose mode, to get the names of the files as they are archived.</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch11Section_5_e">-f mentioning the file name of the resulting tar archive.</p></li>
-</ul></div>
-<p id="ch11Section_5_f">To create archive of folder itself try this:</p>
-<pre class="programlisting">
-$ tar -cvf fortune.tar fortune/</pre>
-<p id="ch11Section_5_10">To add files to existing tar archive, option <span class="emphasis"><em>`r`</em></span> is used:</p>
-<pre class="programlisting">
-$ fortune &gt; fourth.txt
-$ tar -r fourth.txt -vf allfiles.tar
-fourth.txt</pre>
-<p id="ch11Section_5_11">There are other options too available for explicitly mentioning the position of archive, use <span class="emphasis"><em>tar --help</em></span> for getting all the details.</p>
-<p id="ch11Section_5_12">Similarly to remove file from archive use <span class="emphasis"><em>--delete</em></span> option:</p>
-<pre class="programlisting">
-$ tar --delete second.txt -f allfiles.tar
-$ tar -tf allfiles.tar
-first.txt
-third.txt
-fourth.txt</pre>
-</div>
-<div class="section" title="2.2.2.Listing the files of archive:">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2698790"></a>2.2.2.Listing the files of archive:</h4></div></div></div>
-<p id="ch11Section_5_13">Once files are archived, tar command have the <span class="emphasis"><em>`t`</em></span> option, for Listing all files in the tar file:</p>
-<pre class="programlisting">
-$ tar tf allfiles.tar
-first.txt
-second.txt
-third.txt</pre>
-<p id="ch11Section_5_14"><span class="strong"><strong>//this is not working for me in some cases :(</strong></span></p>
-<p id="ch11Section_5_15">To locate a particular file among the archive mention its name after <span class="emphasis"><em>t</em></span> option.</p>
-<pre class="programlisting">
-$ tar t second.txt allfiles.tar
-second.txt</pre>
-<p id="ch11Section_5_16">one can also use elementary regex for locating the file, so in previous case even second.* will also return the same result.</p>
-</div>
-<div class="section" title="2.2.3.Extracting files from archive:">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2698840"></a>2.2.3.Extracting files from archive:</h4></div></div></div>
-<p id="ch11Section_5_17">To extract the content from a archive, use <span class="emphasis"><em>`x`</em></span> option:</p>
-<pre class="programlisting">
-$ mkdir extract
-$ cp allfiles.tar extract/
-$ cd extract
-$ tar -xvf allfiles.tar
-first.txt
-second.txt
-third.txt</pre>
-<p id="ch11Section_5_18">To extract any particular file from archive, mention the name of file after <span class="emphasis"><em>x</em></span> option:</p>
-<pre class="programlisting">
-$ tar -x second.txt -vf allfiles.tar
-second.txt</pre>
-</div>
-</div>
-<div class="section" title="2.3.Further Reading for this section:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2698875"></a>2.3.Further Reading for this section:</h3></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_19"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://en.wikipedia.org/wiki/Tar_(file_format</div>
-<p>)</p>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_1a"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.gnu.org/software/tar/manual/tar.html</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_1b"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://linuxreviews.org/beginner/</div>
-</li>
-</ul></div>
-</div>
-</div>
-<div class="section" title="3.GZip:">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2698920"></a>3.GZip:</h2></div></div></div>
-<p id="ch11Section_5_1c">Tar creates archives but it does not compress data by itself unless specified explicitly. Hence all the archive we create using tar command, is simply of the size of total size of all individual files. With Linux there is a compression tool known as <span class="emphasis"><em>gzip</em></span> which is used to reduce the size of files mentioned. Whenever possible, each file is replaced by one with the extension .gz', so unlike `tar this command would <span class="emphasis"><em>replace the existing file</em></span>.</p>
-<div class="section" title="3.1.Get going:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2698946"></a>3.1.Get going:</h3></div></div></div>
-<p id="ch11Section_5_1d">As usual first commands to check out with gzip are <span class="emphasis"><em>man</em></span> and <span class="emphasis"><em>help</em></span>,</p>
-<pre class="programlisting">
-$ man gzip
-$ gzip --help</pre>
-<p id="ch11Section_5_1e">Creating a zip of a bunch of files is fairly trivial, it can be done simply via:</p>
-<pre class="programlisting">
-$ gzip [OPTION]... [FILE]...</pre>
-<div class="section" title="3.1.1.Creating zip files:">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2698976"></a>3.1.1.Creating zip files:</h4></div></div></div>
-<p id="ch11Section_5_1f">Continuing from previous set of files and setup, we will like to zip them and hence the command would be:</p>
-<pre class="programlisting">
-$ gzip first.txt fourth.txt second.txt third.txt
-$ ls
-allfiles.tar  first.txt.gz  fourth.txt.gz  second.txt.gz  third.txt.gz  zipped.tar.gz</pre>
-<p id="ch11Section_5_20">Hence, as mentioned above, all original files are replaced by .gz extension. The above task can also be restated and made easy with help of some common regex expression:</p>
-<pre class="programlisting">
-$ gzip *.txt</pre>
-<p id="ch11Section_5_21">Similar to <span class="emphasis"><em>tar</em></span> command, one can also use <span class="emphasis"><em>`-v`</em></span> option here to see the output in <span class="emphasis"><em>verbose</em></span> form. For the previous example, if we enable this option the result would be something like this:</p>
-<pre class="programlisting">
-$ gzip -v *.txt
-first.txt:    4.4% -- replaced with first.txt.gz
-fourth.txt:  -7.1% -- replaced with fourth.txt.gz
-second.txt:  -4.8% -- replaced with second.txt.gz
-third.txt:    3.8% -- replaced with third.txt.gz</pre>
-<p id="ch11Section_5_22">For files of very small sizes and some other cases, one might end up with a zipped file whose size is greater then original file, but compression is always performed(so don't be disheartened in the above case, as files are larger :P). So unlike tar, here all files are zipped separately by default, to make them part of one single chunk one can use some <span class="emphasis"><em>pipes</em></span> and <span class="emphasis"><em>redirections</em></span></p>
-<pre class="programlisting">
-$ gzip -c *.txt &gt; all.gz</pre>
-<p id="ch11Section_5_23">Now in this case, all files would be zipped, concatenated and then the output would be written to a file all.gz leaving back all the original files. In the command above <span class="emphasis"><em>`-c`</em></span> option states to print the output to standard output(stdout) and following <span class="emphasis"><em>`&gt;`</em></span> would redirect the output to file all.gz. So when we decompress this file, we will get a single file named 'all' with all the content of each files concatenated one after the another.</p>
-<p id="ch11Section_5_24">For creating a zip archive of a complete directory, one has to use <span class="emphasis"><em>`-r`</em></span> options which means recursive, it makes gzip to traverse through all directory tree/structure. By default it will create zip files of each file inside the directory, that is even with the -r flag, gzip still compresses one file at a time :</p>
-<pre class="programlisting">
-$ gzip -r fortune-files/
-$ gzip -rv .
-./first.txt:          4.4% -- replaced with ./first.txt.gz
-./second.txt:        -4.8% -- replaced with ./second.txt.gz
-./third.txt:          3.8% -- replaced with ./third.txt.gz
-./allfiles.tar:      96.6% -- replaced with ./allfiles.tar.gz
-./fourth.txt:        -7.1% -- replaced with ./fourth.txt.gz</pre>
-<p id="ch11Section_5_25">Hence one always sees files like xxxxx.tar.gz, to create a zip of whole directory in a single file, first archive everything inside a folder and then use gzip on that. For zipping the files using tar itself, one has to use the option <span class="emphasis"><em>`g`</em></span>.</p>
-<pre class="programlisting">
-$ tar -cvzf zipped.tar.gz *.txt
-first.txt
-fourth.txt
-second.txt
-third.txt</pre>
-<p id="ch11Section_5_26"><span class="emphasis"><em>Thats why gzip is designed as a complement to tar, not as a replacement.</em></span></p>
-<p id="ch11Section_5_27">gzip command comes with a option <span class="emphasis"><em>`-l`</em></span> to view the compressed file contents:</p>
-<pre class="programlisting">
-$ gzip -l zipped.tar.gz
-         compressed        uncompressed  ratio uncompressed_name
-            332               10240      97.0% zipped.tar</pre>
-<p id="ch11Section_5_28">Other feature of gzip is option for mentioning the kind of compression one wants. There is a option of <span class="emphasis"><em>`-n`</em></span> where <span class="emphasis"><em>n varies from 0 to 9</em></span> which regulate the speed/quality of compression. With <span class="emphasis"><em>`-1`</em></span> or <span class="emphasis"><em>`--fast`</em></span> option it means the fastest compression method (less compression) and <span class="emphasis"><em>`--best`</em></span> or <span class="emphasis"><em>`-9`</em></span> indicates the slowest compression method, default compression level is <span class="emphasis"><em>`-6`</em></span>.</p>
-<p id="ch11Section_5_29">To decompress a already compressed file there are two options, either use <span class="emphasis"><em>`gunzip`</em></span> command or use <span class="emphasis"><em>`-d`</em></span> option with gzip command:</p>
-<pre class="programlisting">
-$ gzip -dv *.gz
-all.gz:     -440.4% -- replaced with all
-first.txt.gz:         4.4% -- replaced with first.txt
-fourth.txt.gz:       -7.1% -- replaced with fourth.txt
-second.txt.gz:       -4.8% -- replaced with second.txt
-third.txt.gz:         3.8% -- replaced with third.txt
-zipped.tar.gz:       97.0% -- replaced with zipped.tar</pre>
-<p id="ch11Section_5_2a">or:</p>
-<pre class="programlisting">
-$ gunzip -v *.gz</pre>
-<p id="ch11Section_5_2b">Both of those commands will give the same result. So here one can notice the content of file "all" which we created earlier, it will have content of all the rest of four files concatenated one after another, but "zipped.tar.gz" is zip of tar of all files, will effectively have zip of archives of all files separately, and hence the usage and importance of <span class="emphasis"><em>tar</em></span>.</p>
-</div>
-</div>
-<div class="section" title="3.2.Further Reading for this section:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2699199"></a>3.2.Further Reading for this section:</h3></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_2c"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://linuxreviews.org/beginner/</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_2d"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://lowfatlinux.com/linux-gzip-gunzip.html</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_2e"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.gnu.org/software/gzip/manual/gzip.html</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_2f"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://en.wikipedia.org/wiki/ZIP_(file_format</div>
-<p>)</p>
-</li>
-</ul></div>
-</div>
-</div>
-<div class="section" title="4.File Comparisons:">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2699253"></a>4.File Comparisons:</h2></div></div></div>
-<p id="ch11Section_5_30">Linux based distributions also have some utilities for checking the content of files, comparing them very quickly to other files. These operations can be looking for differences/similarities. Some of the commands which prove handy are:</p>
-<div class="section" title="4.1.cmp:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2699270"></a>4.1.cmp:</h3></div></div></div>
-<p id="ch11Section_5_31">If one wants to compare two files whether they are same or not, one can use this handy tool. Let us consider some situation, we run find/locate command to locate some file, and it turns out that we have a file with same name in different location, and in case we want to run a quick check on there content, cmp is the right tool. For my system I perform these tasks to illustrate the use of this command:</p>
-<pre class="programlisting">
-$ find . -name quick.c
-./Desktop/programs/quick.c
-./c-folder/quick.c
-$ cmp Desktop/programs/quick.c c-folder/quick.c
-$</pre>
-<p id="ch11Section_5_32">For me it returns nothing, hence that means both the files are exact copy of each other, by default, cmp is silent if the files are the same. Make some changes in one of the file and rerun the command. For me it works like this:</p>
-<pre class="programlisting">
-$ cmp Desktop/programs/quick.c c-folder/quick.c
-Desktop/programs/quick.c c-folder/quick.c differ: byte 339, line 24</pre>
-<p id="ch11Section_5_33">That is, if files differ, the byte and line number at which the first difference occurred is reported.</p>
-</div>
-<div class="section" title="4.2.diff:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2699312"></a>4.2.diff:</h3></div></div></div>
-<p id="ch11Section_5_34">Now there are situations when one wants to exactly know the differences among two files, for them, GNU diff can show whether files are different without detailing the differences. For simple and basic usage of this programs, consider following example:</p>
-<pre class="programlisting">
-$ echo -e "quick nbrown nfox njumped nover nthe nlazy ndog" &gt; allcharacters.txt
-$ echo -e "quick nbrown nfox njmuped nover nteh nlzay ndog" &gt; problem.txt
-$ diff problem.txt allcharacters.txt
-4c4
-&lt; jmuped
----
-&gt; jumped
-6,7c6,7
-&lt; teh
-&lt; lzay
----
-&gt; the
-&gt; lazy</pre>
-<p id="ch11Section_5_35">Looking at results above mentioned it is very trivial to deduce that, diff if used on two separate text files will result in line by line results for all the lines which are different. So most common use case scenario can be, got some files in various location of system with same name and size, just run diff through them and remove all the redundant files. Other similar command which one can find more effective for this can be <span class="emphasis"><em>sdiff</em></span>, for the same files using sdiff will result in:</p>
-<pre class="programlisting">
-$ sdiff problem.txt allcharacters.txt
-quick                                                               quick
-brown                                                               brown
-fox                                                                 fox
-jmuped                                                            | jumped
-over                                                                over
-teh                                                               | the
-lzay                                                              | lazy
-dog                                                                 dog</pre>
-<p id="ch11Section_5_36">Some exercise for a change:</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *"><p id="ch11Section_5_37">Try using diff for any binary file, does it work?</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch11Section_5_38">What are other equivalent for diff command based on needs/requirements?</p></li>
-<li class="listitem" style="list-style-type: *"><p id="ch11Section_5_39">Can we use diff to compare two directories? If yes how?</p></li>
-</ul></div>
-</div>
-<div class="section" title="4.3.comm:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2699394"></a>4.3.comm:</h3></div></div></div>
-<p id="ch11Section_5_3a">This is one more command which proves handy at times, the short and sweet man page states "compare two sorted files line by line". Or this it compares sorted files and selects or rejects lines common to two files. For ex:</p>
-<pre class="programlisting">
-$ sort allcharacters.txt&gt;sortedcharac.txt; sort problem.txt&gt;sortedprob.txt
-$ comm sortedcharac.txt sortedprob.txt
-             brown
-             dog
-             fox
-     jmuped
-jumped
-lazy
-     lzay
-             over
-             quick
-     teh
-the</pre>
-</div>
-</div>
-<div class="section" title="5.Environment Variables:">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2699424"></a>5.Environment Variables:</h2></div></div></div>
-<p id="ch11Section_5_3b">These variables like HOME, OSTYPE,Variables are a way of passing information from the shell to programs when you run them. Programs look "in the environment" for particular variables and if they are found will use the values stored. Standard UNIX variables are split into two categories, environment variables and shell variables. In broad terms, shell variables apply only to the current instance of the shell and are used to set short-term working conditions; environment variables have a farther reaching significance, and those set at login are valid for the duration of the session.By convention, environment variables have UPPER CASE and shell variables have lower case names.</p>
-<p id="ch11Section_5_3c">Some of examples of Environment variables are(result may vary!):</p>
-<pre class="programlisting">
-$ echo $OSTYPE
-linux-gnu
-$ echo $HOME
-/home/baali</pre>
-<p id="ch11Section_5_3d">To see all the variables and there values use any of following commands:</p>
-<pre class="programlisting">
-$ printenv | less
-$ env</pre>
-<p id="ch11Section_5_3e">The most commonly used environment variable is "PATH", it defines a list of directories to search through when looking for a command to execute. If you decide to put your own programs in a bin directory under your home directory, you'll have to modify the path to include that directory, or the system will never find your programs (unless you happen to be in that directory when you enter the command). Here's how to change your PATH variable so it includes your personal bin directory:</p>
-<pre class="programlisting">
-$ set PATH=$PATH:$HOME/bin</pre>
-<p id="ch11Section_5_3f">See the difference in value of PATH variable before and after modifying it. One can also create its own variable to make things easier:</p>
-<pre class="programlisting">
-$ set repo = $HOME/Desktop/random/code
-$ cd $repo</pre>
-<p id="ch11Section_5_40"><span class="emphasis"><em>set</em></span> command is used to define a variable for the current shell. Try opening a new shell and use the above mentioned command, it wont work as expected. The other child process wont be able to see these variables unless we <span class="emphasis"><em>export</em></span> them. Repeat the above mentioned activity with <span class="emphasis"><em>export</em></span> command. Now with all new shells, <span class="emphasis"><em>$repo</em></span> will work.</p>
-<p id="ch11Section_5_41">Again these changes are limited to current session. To make them permanent or get loaded each time you log in, just add those lines to <span class="emphasis"><em>.bashrc</em></span> file.</p>
-<div class="section" title="5.1.Further Reading:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2699524"></a>5.1.Further Reading:</h3></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_42"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://lowfatlinux.com/linux-environment-variables.html</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_43"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.codecoffee.com/tipsforlinux/articles/030.html</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_44"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.ee.surrey.ac.uk/Teaching/Unix/unix8.html</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_45"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://en.wikipedia.org/wiki/Environment_variable</div>
-</li>
-</ul></div>
-</div>
-</div>
-<div class="section" title="6.Shell Scripting:">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id2699578"></a>6.Shell Scripting:</h2></div></div></div>
-<div class="section" title="6.1.Basics:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2699586"></a>6.1.Basics:</h3></div></div></div>
-<p id="ch11Section_5_46">Shell program or shell script,a sequence of commands to a text file and tell the shell to execute the text file instead of entering the commands. The first <span class="emphasis"><em>"Hello World"</em></span> sample for shell scripting is as easy as it sounds:</p>
-<pre class="programlisting">
-$ echo '#!/bin/sh' &gt; my-script.sh
-$ clear &gt;&gt; my-script.sh
-$ echo 'echo Hello World' &gt;&gt; my-script.sh
-$ chmod 755 my-script.sh
-$ ./my-script.sh
-Hello World</pre>
-<p id="ch11Section_5_47">The #! syntax(also known as shebang) is used in scripts to indicate an interpreter for execution under UNIX / Linux operating systems. The chmod is required to make the script executable. This script will just execute two commands, <span class="emphasis"><em>clear</em></span> and <span class="emphasis"><em>echo</em></span> one after another. One can also do the same task using a one liner command <span class="emphasis"><em>clear; echo 'Hello World';</em></span> but as number of lines grows using a script file is helpful.</p>
-<p id="ch11Section_5_48">So lets create a script which gives us all the filenames for given initial alphabet or string in a directory. Let the name of script be <span class="emphasis"><em>initial.sh</em></span>, open it with text editor, and write:</p>
-<pre class="programlisting">
-#!/bin/sh
-ls &gt; temp
-grep ^$1 &lt; temp
-rm temp
-$ chmod a+x initial.sh
-$ ./initial.sh s</pre>
-<p id="ch11Section_5_49">The $1 in the script is pertaining to command line argument. All arguments passed via command line are accessed via <span class="emphasis"><em>$#</em></span> with name of script being first member, that is $0. Now lets write a script for finding a file, and then checking when was it last modified:</p>
-<pre class="programlisting">
-#!/bin/sh
-name=`find . -name $1 -print`
-echo $name
-last_modified=`stat -c %y $name| cut -f 1 -d " "`
-echo "Last modified: $last_modified"
-$ ./search.sh fname</pre>
-<p id="ch11Section_5_4a">Try giving some file you want to search in place of fname. Please note in second line <span class="emphasis"><em>`</em></span> its a back-quote(other key mapped with tilda), it is specifically used to get the output of one command into a variable. In this particular case name is a User defined variables (UDV) which stores the value. We access value stored in any variable using <span class="emphasis"><em>$</em></span> symbol before name of variable.</p>
-<p id="ch11Section_5_4b">naming conventions for variables?? do we need them??</p>
-</div>
-<div class="section" title="6.2.Shell Arithmetic:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2697944"></a>6.2.Shell Arithmetic:</h3></div></div></div>
-<p id="ch11Section_5_4c">Shell also provides support for basic arithmetic operations. The syntax is:</p>
-<pre class="programlisting">
-$ expr op1 math-operator op2</pre>
-<p id="ch11Section_5_4d">Some of example which can be tried handily:</p>
-<pre class="programlisting">
-$ expr -3 + 5
-2
-$ expr 10 % 3
-1</pre>
-<p id="ch11Section_5_4e">These spaces in between operator and operands is important, without them shell interpreter will raise the syntax error.</p>
-<pre class="programlisting">
-$ expr 2*3
-expr: syntax error</pre>
-<p id="ch11Section_5_4f">One can use back-quotes(`) also to get value of expr.</p>
-<pre class="programlisting">
-$ echo `expr 6 + 3`
-9
-$ result=`expr 6 + 3`
-$ echo $result
-9</pre>
-<p id="ch11Section_5_50">Shell uses three kinds of quotes. Double quotes("), anything enclosed among them except from variable trailing after $, and characters after would be printed as it is. Single quotes('), anything enclosed within them is just same, no formulation/interpretation. Back quotes(`), anything inclosed is considered as command, or is executed.</p>
-<pre class="programlisting">
-$ echo "Today is date"
-Today is date
-$ echo "Today is `date`"
-Today is Wed Sep 16 17:32:22 IST 2009
-$ echo 'Today is `date`'
-Today is `date`
-$ echo "Today is  n `date`"
-Today is  n Wed Sep 16 17:40:13 IST 2009
-$ echo -e "Today is  n `date`"
-Today is
- Wed Sep 16 17:41:13 IST 2009</pre>
-</div>
-<div class="section" title="6.3.if else construct:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2699963"></a>6.3.if else construct:</h3></div></div></div>
-<p id="ch11Section_5_51">One can have simple <span class="emphasis"><em>if else if</em></span> constructs in shell scripts to check conditions. Lets take simple example of writing a script which returns back whether the argument passed is positive or not:</p>
-<pre class="programlisting">
-#!/bin/sh
-if test $1 -gt 0
-then
-  echo "number is positive"
-else
-  echo "number is negative"
-fi
-$ ./sign.sh -11
-number is negative</pre>
-<p id="ch11Section_5_52">This script will compare the first value passed as argument with 0 <span class="emphasis"><em>if test var -gt val</em></span>, var being $1 and val being 0, gt meaning greater then. Now this program has some flaw, it will give same result for following input: (-11) and (-1, 5), as we are checking just $1 which is first argument and hence the result. For handling such situation we can include <span class="emphasis"><em>if-else</em></span> clause which will warn user of correct usage of script.</p>
-<pre class="programlisting">
-#this is the case when no argument is passed
-if [ $# -eq 0 ]
-then
-  echo "$0 : You must give/supply one integers"
-  exit 1
-else
-  if [ $# -gt 1 ]
-  then
-    echo "$0 : You must give one integer"
-    exit 1
-  fi
-fi</pre>
-<p id="ch11Section_5_53">One important thing to not in shell script is spacing, with many comparison and evaluation operation a wrongly placed space will spoil all the fun. So in previous example the expression <span class="emphasis"><em>[ $# -eq 0 ]</em></span> will work properly, but if we remove those leading or trailing spaces like <span class="emphasis"><em>[ $# -eq 0]</em></span>, it wont work as expected, or rather throw a warning. Both <span class="emphasis"><em>test</em></span> and <span class="emphasis"><em>[]</em></span> do the same task of testing a expression and returning true or false.</p>
-<p id="ch11Section_5_54">Lets create something interesting using these if-else clause. Now we will create a script which will greet the user when he opens the shell. We will create the script, change the permission to make it executable and append the <span class="emphasis"><em>.bashrc</em></span> file with <span class="emphasis"><em>./greet.sh</em></span> line and we are done. The script is:</p>
-<pre class="programlisting">
-#!/bin/sh
-#Script to greet the user according to time of day
-temph=`date | cut -c12-13`
-dat=`date +"%A %d in %B of %Y (%r)"`
-if [ $temph -lt 12 ]
-then
-  mess="Good Morning $LOGNAME, Have a nice day!"
-fi
-
-if [ $temph -gt 12 -a $temph -le 16 ]
-then
-  mess="Good Afternoon $LOGNAME"
-fi
-
-if [ $temph -gt 16 -a $temph -le 18 ]
-then
-  mess="Good Evening $LOGNAME"
-fi
-echo -e "$mess nThis is $dat"</pre>
-<p id="ch11Section_5_55">For me when I open the shell the output is something like:</p>
-<pre class="programlisting">
-Good Morning baali, Have a nice day!
-This is Wednesday 16 in September of 2009 (11:54:47 AM IST)</pre>
-</div>
-<div class="section" title="6.4.Loops">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2700069"></a>6.4.Loops</h3></div></div></div>
-<p id="ch11Section_5_56">Bash has three different commands for looping -- <code class="literal">for</code>, <code class="literal">while</code> and <code class="literal">until</code>.</p>
-<div class="section" title="6.4.1.for loop">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2700092"></a>6.4.1.<code class="literal">for</code> loop</h4></div></div></div>
-<p id="ch11Section_5_57">Suppose we have a set of files, that have names beginning with numbers followed by their names - <code class="literal">08 - Society.mp3</code>. We would like to rename these files to remove the numbering. How would we go about doing that? It is clear from the problem statement that we could use a <code class="literal">for</code> loop, to loop through the list of files and rename each of the files.</p>
-<p id="ch11Section_5_58">Let's first look at a simple <code class="literal">for</code> loop, to understand how it works.</p>
-<pre class="programlisting">
-for animal in rat cat dog man
-do
-  echo $animal
-done</pre>
-<p id="ch11Section_5_59">We just wrote a list of animals, each animal's name separated by a space and printed each name on a separate line. The variable <code class="literal">animal</code> is a dummy variable and has no significance. You could use something as lame as <code class="literal">i</code> in place of <code class="literal">animal</code>.</p>
-<p id="ch11Section_5_5a">Now, we use a simple <code class="literal">for</code> loop to list the files that we are interested in.</p>
-<pre class="programlisting">
-ls *.mp3 &gt; list
-for i in `cat list`
-do
-  echo "$i"
-done</pre>
-<p id="ch11Section_5_5b">If your filenames contain spaces, <code class="literal">for</code> assumes each space separated word to be a single item in the list and prints it in a separate line. We could change the script slightly to overcome this problem.</p>
-<pre class="programlisting">
-for i in *.mp3
-do
-  echo "$i"
-done</pre>
-<p id="ch11Section_5_5c">Now, we have each file printed on a separate line. Depending on the files that we have we could use grep to get the relevant portion of the filenames and rename the files.</p>
-<pre class="programlisting">
-for i in *.mp3
-do
-  j=$(echo "$i"|grep -o "[A-Za-z'&amp;. ]*.mp3")
-  echo "$i -&gt; $j"
-done</pre>
-<p id="ch11Section_5_5d">Now we just replace the echo command with a <code class="literal">mv</code> or a <code class="literal">cp</code> command.</p>
-<pre class="programlisting">
-for i in *.mp3
-do
-  j=$(echo "$i"|grep -o "[A-Za-z'&amp;. ]*.mp3")
-  cp "$i" "$j"
-done</pre>
-<p id="ch11Section_5_5e">As an exercise, you could try sorting the files in reverse alphabetical order and then prefix numbers to each of the filenames.</p>
-</div>
-<div class="section" title="6.4.2.while">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2700210"></a>6.4.2.<code class="literal">while</code>
-</h4></div></div></div>
-<p id="ch11Section_5_5f">The <code class="literal">while</code> command allows us to continuously execute a block of commands until the command that is controlling the loop is executing successfully.</p>
-<p id="ch11Section_5_60">Let's start with the lamest example of a while loop.</p>
-<pre class="programlisting">
-while true
-do
-  echo "True"
-done</pre>
-<p id="ch11Section_5_61">This, as you can see, is an infinite loop that prints the <code class="literal">True</code>.</p>
-<p id="ch11Section_5_62">Say we wish to write a simple program that takes user input and prints it back, until the input is <code class="literal">quit</code>, which quits the program.</p>
-<pre class="programlisting">
-while [ "$variable" != "quit" ]
-do
-  read variable
-  echo "Input - $variable"
-done
-exit 0</pre>
-</div>
-<div class="section" title="6.4.3.until">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="id2700260"></a>6.4.3.<code class="literal">until</code>
-</h4></div></div></div>
-<p id="ch11Section_5_63">The <code class="literal">until</code> loop is similar to the <code class="literal">while</code> loop, except that it executes until the conditional command does not execute properly.</p>
-<p id="ch11Section_5_64">The infinite loop changes to the following, when <code class="literal">until</code> is used.</p>
-<pre class="programlisting">
-until false
-do
-  echo "True"
-done</pre>
-<p id="ch11Section_5_65">Now lets try and use these above mentioned options provided by shell to write a utility. Until now, when we try find or locate it looks through directories and files for result. But they wont search through tar archives and zipped files. Lets create a shell script for especially looking through these files</p>
-<pre class="programlisting">
-#!/bin/sh
-
-#To check number of arguments being passed.
-if [ $# -eq 0 ] ; then
-echo "Correct usage: $0 tar-archive filename  nOr $0 filename"
-exit 1
-else
-  if [ $# -eq 1 ] ; then
-    tar_archive=`find $PWD -name "*.tar*"`
-  else
-    tar_archive=`find $PWD -name $1`
-  fi
-fi
-
-#Search of particular file inside archives.
-for archive in $tar_archive
-do
-  echo $archive
-  variable=`tar -tf $archive`
-  for word in $variable
-  do
-    if [ $# -eq 1 ] ; then
-      echo "$word" | grep -q ".*$1"
-    else
-      echo "$word" | grep -q ".*$2"
-    fi
-  if [ $? -eq 0 ] ; then
-    echo "File present in $archive!"
-  fi
-  done
-done</pre>
-</div>
-</div>
-<div class="section" title="6.5.Functions">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2700315"></a>6.5.Functions</h3></div></div></div>
-<p id="ch11Section_5_66">When a group of commands are repeatedly being used within a script, it is convenient to group them as a function. This saves a lot of time and you can avoid retyping the code again and again. Also, it will help you maintain your code easily. Let's see how we can define a simple function, <code class="literal">hello-world</code>. Functions can be defined in bash, either using the <code class="literal">function</code> built-in followed by the function name or just the function name followed by a pair of parentheses.</p>
-<pre class="programlisting">
-function hello-world
-{
-echo "Hello, World.";
-}
-
-hello-world () {
-  echo "Hello, World.";
-}
-
-$ hello-world
-Hello, World.</pre>
-<p id="ch11Section_5_67">Passing parameters to functions is similar to passing them to scripts.</p>
-<pre class="programlisting">
-function hello-name
-{
-echo "Hello, $1.";
-}
-
-$ hello-name 9
-Hello, 9.</pre>
-<p id="ch11Section_5_68">Any variables that you define within a function, will be added to the global namespace. If you wish to define variables that are restricted to the scope of the function, define a variable using the <code class="literal">local</code> built-in command of bash.</p>
-<p id="ch11Section_5_69">We shall now write a function for the word frequency generating script that we had looked at in the previous session.</p>
-<pre class="programlisting">
-function word_frequency {
-  if [ $# -ne 1 ]
-  then
-    echo "Usage: $0 file_name"
-    exit 1
-  else
-    if [ -f "$1" ]
-    then
-      grep  "[A-Za-z]*" -o "$1" | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | less
-    fi
-  fi
-}</pre>
-<p id="ch11Section_5_6a">As an exercise, modify the function to accept the input for the number of top frequency words to be shown (if none is given, assume 10).</p>
-</div>
-<div class="section" title="6.6.Further Reading:">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="id2700386"></a>6.6.Further Reading:</h3></div></div></div>
-<div class="itemizedlist"><ul class="itemizedlist" type="*">
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_6b"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://www.freeos.com/guides/lsst/</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_6c"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://bash.cyberciti.biz/guide/Main_Page</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_6d"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://tldp.org/LDP/abs/html/</div>
-</li>
-<li class="listitem" style="list-style-type: *">
-<p id="ch11Section_5_6e"></p>
-<div class="reference">
-<div class="titlepage"><hr /></div>http://tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html</div>
-</li>
-</ul></div>
-</div>
-</div>
-</div>
-</div></body>
-</html>
-
--- a/SEESenv/web/html/chn12index.html	Tue Mar 02 17:07:14 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<html>
-<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Chapter. index</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="ch12index">
-<div class="titlepage"></div>
-<div class="toc">
-<p><b>Table of Contents</b></p>
-<dl><dt><span class="article"><a href="#id2757738"></a></span></dt></dl>
-</div>
-<div class="article"><div class="titlepage">
-<div><div><h2 class="title" id="id2757738"></h2></div></div>
-<hr />
-</div></div>
-</div></body>
-</html>
-
--- a/sees.hook	Tue Mar 02 17:07:14 2010 +0530
+++ b/sees.hook	Tue Mar 02 18:49:48 2010 +0530
@@ -1,6 +1,6 @@
 repo_scripts="/home/hg/repos/SEES-hacks/SEESenv/scripts"
 temp_dir="/home/hg/repos/SEES-hacks"
-repo="/home/hg/repos/test/sttp/"
+repo="/home/hg/repos/test_review/sttp/"
 mkdir $temp_dir/temp 
 python $repo_scripts/myrst2xml.py $repo
 python $repo_scripts/rst2docbook.py $temp_dir/temp