Post by yongjian
这是我做的习题一的代码,在自己的机子上运行结果正确,不过看来还得在其他人的机器上试试才行。
第一个文件叫cmd1,第二个文件叫cmd1_desc.
sed:
for i in $(seq 1 $(wc -l cmd1|sed 's/\(^.*\) .*/\1/g')); do j=$(cat cmd1_desc | sed -n 'H;/^$/{x;s/\n/ /g;G;p;}'|sed '/^ $/d;/^$/d;s/ \+/ /g' | sed -n ''$i'p'); k=$(cat cmd1 | sed -n ''$i's/.*/&:/p' | sed '$a\'"$j"'');echo -e "$k\n" ;done | sed '$d'
#######
#
# CS385 Unix/Linux Shell Programming and System Administration
#
# FINAL PROJECT
#
#
#######
Write a shell [not Perl or other] script to validate URL links in a bookmark file(exported from IE) per following requirements:
1. The script should display a menu-based question to show the URL and offer the user to delete a broken link or ignore the broken link.
2. The script should display messages such as "OK" if the link is working or "search completed" when the search is done.
3. Add necessary comments in the script for readability.