Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Hello, i've got a file with sorted words - one on each line.
How could it be possible to delete thouse lines that have words of length 1 or 2 (1-2 letters). I guess a good way it will be with AWK, n its fuction length(), but getting it, i dont know how to delete those very lines..
THANKS in advance !!!
ok... its a part of a bigger project.. ive got some files from a folder, deleting any chars except letters, stemming it, delete the stopwords.. n i got to count the different words, but it still remains some gabbage like 1 word letters.. taht i want to remove..
if [ -d "$*" ]
then
cat "$1"/*.txt > f
file=f
fi
sed "s/--/ /g" < "$file" | sed "s/[-'_]//g" | sed "s/[0-9]//g"| tr -d '=:;-_|"<>.,?!@#*&^[](){}' | tr "[A-Z]" "[a-z]" > ff
Can you please put some effort in writing correctly? If I understand your second post correctly, you can do it with 'sed' and the answer is on this page: http://sed.sourceforge.net/sed1line.txt
Ahhh.. OK i guess i wasn't so clear.. Vocabulary.txt contains also the word frequency... so having 4266 a (a is 4266 times in the file), Sed didn't delete it, maybe because im using bash shell?!?!?
Ahhh.. OK i guess i wasn't so clear.. Vocabulary.txt contains also the word frequency... so having 4266 a (a is 4266 times in the file), Sed didn't delete it, maybe because im using bash shell?!?!?
Bash is the standard shell in linux and 'sed' is a small tool that runs in Bash.
The sed command prints all the lines that are longer than 2 characters. Isn't that what you wanted to achieve?
I'd be easier to post a representative extract of the file.
Maybe because at the beggining i said that i wanted to delete a line by the length of a word..
Still no success... but can i get any explanations about the s: &: p ?? what exactly do they do?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.