Untitled
unknown
plain_text
2 months ago
891 B
1
Indexable
Never
#!/bin/bash # Kiểm tra xem người dùng đã nhập tên tệp đầu vào hay chưa if [ "$#" -ne 1 ]; then echo "Sử dụng: $0 <tên tệp danh sách>" exit 1 fi input_file="$1" output_file="subplan.xml" # Kiểm tra xem tệp testcaselist.txt tồn tại if [ ! -f "$input_file" ]; then echo "Tệp $input_file không tồn tại." exit 1 fi # Mở tệp kết quả để ghi > "$output_file" # Xử lý tệp và ghi kết quả vào tệp kết quả while IFS= read -r line do # Xóa ký tự xuống dòng cuối dòng cleaned_line=$(echo "$line" | sed -e 's/[\r\n]\+//g') # Thêm "<Entry include=" vào đầu và ""/>" vào cuối mỗi dòng processed_line="<Entry include=\"$cleaned_line\"/>" echo "$processed_line" >> "$output_file" done < "$input_file" echo "Đã xóa ký tự xuống dòng và thêm <Entry include=\"...\"/> vào $output_file."