The problem i am facing is this command only picks the data which matches the condition and writes into the file buzz.
I really needed the whole file with the changes .
Can Sed or awk needs to be used .
Below is the sample of the data file.
Z03741 67595 1266767IUFIUFJJJ aaaa bbbbb cccc dd. xxxxxxx aaaa bbb cccc, Inc. Tst . Floor 2 El Segundo 847474 sdfd df jjdkdkd dfdfd ssdfsdfsdf CA
Z03741 67595 1220CNBT1
... by the way i don't know about your fgrep implementation, but i would bet there is the -i option available to make you grep ignore case .
so fgrep -i yuyu .... will grep any combination like
Do you really want to edit in-place? If anything goes wrong you've destroyed your original, not a copy!
You can't just redirect into the same file you're reading from either, because you'd end up deleting the file before you even begin reading from it. Hence why this, and most shell utilities, don't edit in-place. Modifying the original is easy enough without that: