When i use the grep command as follows :
rollno=4
grep $rollno=4 new.txt
it returns the records that contain 44 or 4444 or 24,etc as roll no.How do i eliminate this flaw?
|
If you have GNU
|
|||
|
|
|
If your file contains one record per line, you can use
The |
|||
|
|
|
check this link: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_02.html use "^" if it is not starting with 'roll number' |
|||
|
|
|
Check that
|
||||
|
|
grep 4=4 new.txt. Is it what you want? – kev Oct 21 '12 at 12:204matches all lines that at least contains character4, no matter of rest – skrco Oct 21 '12 at 14:34