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.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have text file which has 1 word per line , but there are lines which has word from 1 or 2 character like as in on ,etc. I want to delete this word from my file, how can i do that.
Oh, sorry, didn't get your question at first.. This sed '/^..$/d' -i <filename>
should remove all lines that comtain only two characters. Similarly for 1-character lines sed '/^.$/d' -i <filename>
Do you want to know which file contains a specific word? Then you need the grep command.
Or, are you asking which words will the abovementioned commands delete?
I didn't quite get your question, sorry.
Is this homework? Sure sounds like homework the way your asking your questions and not being very clear on your questions, then coming up with more questions?
this is not home work , i am already graduating from univ. And it is not my habit to ask many, but my knowledge about text processing is not good, that set.
Mr trickykid, do't accuse from your imagination without ask me first , because life is not standard case.
this is not home work , i am already graduating from univ. And it is not my habit to ask many, but my knowledge about text processing is not good, that set.
Mr trickykid, do't accuse from your imagination without ask me first , because life is not standard case.
I thought I did ask. That's why I have ? at the end of each sentence. So before you start accusing me of anything, better look twice that I have moderator under my name and I'm doing my job for the integrity of this site by probing suspicious threads/questions, etc. You're posts seem fishy, you worded your questions as if they were homework, don't do that if you don't want to be accused. Now, go read up on sed, awk and grep.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.