LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-20-2013, 12:56 AM   #16
Zelator
Member
 
Registered: Jul 2005
Location: Melbourne Australia
Distribution: Manjaro
Posts: 78

Rep: Reputation: 17
Unhappy Now UNSOLVED again


The history is at https://bugs.kde.org/show_bug.cgi?id=65740
Alas the External Tools plugin has been dropped as too many bugs had crept in - http://kate-editor.org/2011/08/09/ma...-tools-plugin/ - so that solution is out.
At some time in the future we may get something via Python - http://kate-editor.org/2012/06/26/ex...te-with-pytho/
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-16-2013, 10:16 PM   #17
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Activate the "Text Filter" plugin, select the text, and start the filter (Tools->Filter Text, or Ctrl+/). In the pop-up box, check the "Copy" box and enter the "wc -w" command in the text box. You word count will be the top entry in your clipboard, which you can paste anywhere you want, or just look at in your copy stack.
 
Old 05-17-2013, 03:24 AM   #18
Zelator
Member
 
Registered: Jul 2005
Location: Melbourne Australia
Distribution: Manjaro
Posts: 78

Rep: Reputation: 17
Indeed, the Tools->Filter Text does work, but if, like me, you need to check the word count frequently, it is a bit cumbersome. I have Konsole open with a wc command in it that I can alt/tab to and from very quickly. It's either that or Libre Office until someone fixes Kate. I'd love to do it myself but the learning curve would be over the horizon.
 
Old 05-19-2013, 03:18 PM   #19
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Talking A general solution: word count for any text selection using Klipper

O.K., here's a "work around" that works for me:
  1. Create this script, say kwc, in a directory in your search path. (I have a ~/bin directory I use for such things.)
    Code:
    if [ -n "$1" ]
    then 
      msg="$(echo "$1" | wc -cmwl | gawk '{printf("%s line%s\n%s word%s\n%s character%s\n",$1,($1>1)?"s":"",$2,($2>1)?"s":"",$3,($3>1)?"s":"")}')"
      kdialog --msgbox "${msg}"
    else
      msg="Please select the text for which you desire statistics."
      kdialog --error "${msg}"
    fi
  2. Make the code executable (e.g., chmod +x ~/bin/kwc)
  3. Install the clipboard tool (I use Klipper since I run under KDE, but I think that GNOME has a similar tool.) Note: The following assumes klipper.
  4. Right click on the clipboard in the task bar, and click the "Enable user actions" box.
  5. Create a action, with no regular expression, containing kwc %s. (Use whatever your name choice you made, and any description you want. Be sure to pass the %s argument to the script -- that's the "current active clipboard contents.")
  6. Open the Klipper "Configure Kilpper" item, and verify that the "Synchronize contents of the clipboard and the selection" is checked, and, optionally -- depending on how else you use you clipboard -- check the "Text selection only" box. (Note that you can also change your history size here.)
  7. Close the Klipper configurarion window.
  8. Go to kate or, actually, anywhere you can do a text selection, and select some text.
  9. Right-click on the Klipper in the task bar, and click on the "Manually select a user action." item, and then select kwc (or whatever you called it) in the pop-up.

Last edited by PTrenholme; 05-19-2013 at 03:24 PM. Reason: Minor typo
 
Old 07-03-2014, 11:18 AM   #20
maredeb
LQ Newbie
 
Registered: Jul 2014
Posts: 1

Rep: Reputation: Disabled
Simple wc solution

If you have the terminal activated, there is a simple solution to use wc in it:

* type wc<enter> in terminal, wc is waiting for input now
* select text you want to count
* tools - pipe to terminal
* press ctrl-d in terminal to end the input

voila: wc counts for you
 
Old 01-12-2016, 08:53 AM   #21
NitroGL
LQ Newbie
 
Registered: Jan 2016
Distribution: Slackware64 Multilib Current
Posts: 1

Rep: Reputation: Disabled
A very simple solution

A very quick solution is that of using REGEX.

Press "Edit -> Replace..." (you're not going to replace, but if you pressed "Find..." you could not see the "mode" section.
Be sure that "Mode: " is set to "Regular expression"

Write one of the following into "Find: " box to count:
  • characters: [^\0]
  • words: [^\s]
(including square brackets)

Finally, press "Find All". Its result count is what you need.

If you forget it, once used, you can retrieve them in the history of "Find: " box.
 
Old 03-07-2018, 02:31 AM   #22
pavlo_m
LQ Newbie
 
Registered: Mar 2018
Posts: 1

Rep: Reputation: Disabled
Quote:
A very quick solution is that of using REGEX.
Unfortunately this not works. I tried with Kate 15.12.3 and 16.08.0 and they have same problem with search. It stops search after a quite small threshold (few thousand search occurrences) on a quite small data portion. The threshold is not constant and it can count different number on same conditions (text and search). You will not get any alert and just get wrong result. I test with file not stored on disk (just copy/paste few lines in editor window)
 
  


Reply

Tags
count, editor, kate, text, word



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in word count command grunge_1 Linux - General 4 03-20-2009 04:01 AM
variable length string using GD (word wrap, carriage return, word/character count)? frieza Programming 1 02-14-2009 05:21 PM
Word count with grep DiagonalArg Linux - Software 3 02-13-2006 12:46 PM
word count pantera Programming 2 08-31-2004 07:23 AM
word count in a line pantera Programming 4 08-25-2004 01:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration