Regular expressions, Text editing in the command line
hello everyone, I've been given an assignment from school. My teacher has given me a simple text file that looks as followed.
* note there are some spelling errors in this list.
I have to make a script that turns the above list into something like this.
I can get it to work without the spelling errors in the first list using these simple commands.
Sed 's/Asda//g' Asda.txt > Asdafin.txt
sed -i '1s/^/Asda /' Asdafin.txt
This however isn't quite the way it should be because if I accidentally misspell Asda it won't copy that line.
I know there is something like regular expressions but I'm not quite sure how to implement this in my script.
Any tips and pointers are really appreciated.
Thanks in advance, Mikhail.