grep " string" <file> will return all the rows which containing the search string found. But, what I need is able to pull out the string/pattern from certain position, such as field 3 or position 1 to 20, can I use grep here? and if yes, how to identify the position or field in the same 'grep' command?
If would have thought that misercord's example above would work fine. To find lines in file.txt where the string 'help' starts in the 8 character I would type:
grep '.......help' file.txt
I don't have a UNIX system here at the moment (reinstalling HPUX as I type) so I can't test it, sorry. Mike
"Experience is the comb that Nature gives us after we are bald."
Is that a haiku?
I never could get the hang
of writing those things.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.