I have an assignment saying "Using bash scripts and command line tools, implement the following functionality: Your created script should be run like this: and it should process *.txt files in that directory. This processing includes following steps: 1. make all alphabets small case 2. remove all xml/html tags 3. replace all acronyms found in text file 4. convert all numbers to words HINT:-You can use sed command."
I have written the code as shown in the image. I'm actually really new to linux so I had to search for different commands to make this work. However, as the assignment requires, the output should actually create another file, and write the modified content (after the applied 4 processes) on that new file, rather than printing every action on the terminal separately.
#1. Converts all text inside file 1.txt to lowercase tr '[A-Z]' '[a-z]' < 1.txt #2. Removes html/xml tags from the text sed -e 's/<['^]>'*>//g' 1.txt #3 Replaces all acronyms with full names sed 's/doc/document/' 1.txt #4 Converts all numbers to full words sed 's/2/two/' 1.txt
File text: This is a RANDOM doc. There are 2 such docs. < b > I don't care < / b >
Expected output: this is a random document. there are two such documents. i don't care