1. The problem statement, all variables and given/known data:
Hey there, I'm brand new to using Unix as I just started a course on it in my University, and I currently working through a worksheet which focuses on the many commands and methods of GREP (I'm working through the terminal command line in Unix). Currently I am confused with using Grep and vi in the same command. Here is what the question describes.
Quote:
i) When the data was input into the carslist.txt file, the data input clerk made an error with the CAPS LOCK key, when entering details about a “Peugeot” car. How could you use the grep command to find all types of “Peugeot” cars irrespective of the data input clerk's error?
j) Using the command you've found in i), identify the incorrect record in the file, and appropriately correct the record affected using vi.
I found out that by using -i in the command that it will search for words even if they have different upper case/lower case differences, as long as they are correctly spelt the same. However as it mentions in j, it asks for me to correct the spelling error using vi, and I am unsure about how to use this method, or at least how to use it with GREP anyway as I have use gvip (I believe it was) in a past worksheet.
2. Relevant commands, code, scripts, algorithms:
To complete i, I simply used the code grep -i Peugeot carslist.txt to find any word matching 'Peugeot', despite the differences in upper/lower case lettering.
3. The attempts at a solution (include all code and scripts):
As I just mentioned I have previously used the code grep -i Peugeot carslist.txt to show all the words matching Peugeot despite the differences in upper & lower case letters, but I am unsure as to how vi is involved with changing any cases in the word to upper/lower.
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Aberystwyth University, West Wales, Adrian Shaw, CS10110 - Introduction To Computer Hardware, Operating Systems, And Unix Tools
Also once this problem is 'hopefully solved' I may be posting more in this thread about any other GREP related issues I am having with my work. Hopefully I am allowed to do this, but if not I can always create new threads about it. If I need to include anything else with my question just say and I will make sure to do so. Hopefully I didn't do anything wrong in asking these questions and that someone will be able to help me with my concerns. =-)