Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
how can i grep a specific string ???
i want to grep something like this <whatIwant> i want this only So
grep -o "\<*\>" file > tofile Didn't work
grep -o "<*>" file > tofile Didn't work also
i want to grep just words between this '<' and this '>' symbols
neither this nor that worked ..
i just want string between something like
<anything> to be grepd not the whole line
when just i say grep "<this>" fromfile > tofile
then i have tofile contain somthing like that
those examples didn't do so at all
Post up a couple-three lines of the actual text you want to parse and then the result you'd want from those lines.
Based on your description, either of our solutions do work (and homey's sed is way better ), so we must not be following your description. Or maybe you're using a weird shell or weird versions of commands.
-- Here's a copy'n'paste from my xterm:
1016>> cat testfile
testing <this thing> out
testing this thing out
testing <that thing> out
1017>> sed -n 's/\(.*\)\(<.*>\)\(.*\)/\2/p' testfile > results
1018>> cat results
-- edit2 -- are you using the brackets as examples or are they actually what you want to parse? And do you want them actually in the results or not? That may be part of it.
<this mean > , <the meaning>, this mean <the meaning>, this Mean <the meaning>, but this mean <the meaning>, and this mean <the meaning>, not like this <the meaning>, even this , don't like any of this this mean <the meaning>, this mean <the meaning>, "this mean "<the meaning>, Mine Iz Like this <the meaning>, NOT @ All ,this mean <the meaning>,