View a file and count all words beginning with specificletter


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers View a file and count all words beginning with specificletter
# 8  
Old 03-30-2019
It helps to know what operating system and shell you're using since the utilities on various operating systems have options that might help with what you are trying to do that are not available on other operating systems. Whenever you start a new thread here, please always tell us what shell and operating system you're using.

We need a much clearer definition of what you consider to be a word starting with "s" or "S". Is a word just alphabetic characters? Can hyphens be included in a word (e.g., sub-sonic)? Can numeric characters be included in a word (e.g., "straight-6")? Can apostrophes be included in a word (e.g., "she's")? When apostrophes can be included in words, how are we to distinguish between a phrase surrounded by single-quotes and a word containing a hyphen? (Note that regular expressions in grep can only look at a single line and quoted strings can cross many line boundaries.)

And, if we can't see a sample of the data you're working with and the output you expect to get from it, we have no way to verify that anything we might suggest might work for you. Please give us a representative sample input and the corresponding exact output you hope to produce from that input.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count words from file

hi all how to count words from a text aaa bbb ccc ddd 123 aaa 123 aaa aaa ddd 123 i need to cout hoe many time the words "aaa" and "123" each appears the output should be 4 3 or 4 3 or aaa 4 123 3 thanks (10 Replies)
Discussion started by: sharong
10 Replies

2. Shell Programming and Scripting

Add words in beginning , end after removing a word in a file

My file has the entries like below... /dev/sds /dev/sdak /dev/sdbc /dev/sdbu I want to make the file like below echo 1 > /sys/block/sds/device/rescan echo 1 > /sys/block/sdak/device/rescan echo 1 > /sys/block/sdbc/device/rescan echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Discussion started by: saravanapandi
2 Replies

3. UNIX for Dummies Questions & Answers

Count dynamic words in file

Hello, i want built a log analyzer for nginx. Okay and i use it as training for the shell tools. The most what i want i could relize. But i has trouble with dynamic things. I have the IP address extracted and has set the geo localtion for the ip. I would like to count the countries. With... (3 Replies)
Discussion started by: sisihagen
3 Replies

4. Shell Programming and Scripting

How count the number of two words associated with the two words occurring in the file?

Hi , I need to count the number of errors associated with the two words occurring in the file. It's about counting the occurrences of the word "error" for where is the word "index.js". As such the command should look like. Please kindly help. I was trying: grep "error" log.txt | wc -l (1 Reply)
Discussion started by: jmarx
1 Replies

5. Shell Programming and Scripting

problem to count number of words from file

hi every one i have written this simple shell for counting number of word that user need to find from file but i have get several error when run it. can someone tell me the problem ? echo "Enter the file name" read file echo "enter word" read word for i in \`cat $file` do if then... (1 Reply)
Discussion started by: nimafire
1 Replies

6. Shell Programming and Scripting

count frequency of words in a file

I need to write a shell script "cmn" that, given an integer k, print the k most common words in descending order of frequency. Example Usage: user@ubuntu:/$ cmn 4 < example.txt :b: (3 Replies)
Discussion started by: mohit_iitk
3 Replies

7. UNIX for Dummies Questions & Answers

Count Number Of lines in text files and append values to beginning of file

Hello, I have 50 text files in a directory called "AllFiles" I want to make a program that will go inside of the "AllFiles" Directory and count the number of lines in each individual text file. Then, the program will calculate how many more lines there are over 400 in each text file and... (7 Replies)
Discussion started by: motoxeryz125
7 Replies

8. Shell Programming and Scripting

Shell script to find out words, replace them and count words

hello, i 'd like your help about a bash script which: 1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel, 2.finds the link which leads to the download location of the Latest Stable Kernel version, (the right link should lead to the file... (3 Replies)
Discussion started by: alex83
3 Replies

9. Shell Programming and Scripting

Help in counting the no of repeated words with count in a file

Hi Pls help in solving my doubt.Iam having file like below file1.txt priya jenny jenny priya raj radhika priya bharti bharti Output required: I need a output like count of repeated words with name for ex: priya 3 jenny 2 (4 Replies)
Discussion started by: bha148
4 Replies

10. UNIX for Dummies Questions & Answers

Remove words beginning with a certain character from a file

Hi, how could you go about removing words that begin with a certain character. assuming that this character is '-' I currently have echo "-hello" | sed s/-/""/ which replaces the leading dash with nothing but I want to remove the whole word, even if there are multiple words beginning... (3 Replies)
Discussion started by: skinnygav
3 Replies
Login or Register to Ask a Question
otp(n)							RFC 2289 A One-Time Password System						    otp(n)

__________________________________________________________________________________________________________________________________________________

NAME
otp - One-Time Passwords SYNOPSIS
package require Tcl 8.2 package require otp ?1.0.0? ::otp::otp-md4 ?-hex? ?-words? -seed seed -count count data ::otp::otp-md5 ?-hex? ?-words? -seed seed -count count data ::otp::otp-sha1 ?-hex? ?-words? -seed seed -count count data ::otp::otp-rmd160 ?-hex? ?-words? -seed seed -count count data _________________________________________________________________ DESCRIPTION
This package is an implementation in Tcl of the One-Time Password system as described in RFC 2289 (1). This system uses message-digest algorithms to sequentially hash a passphrase to create single-use passwords. The resulting data is then provided to the user as either hexadecimal digits or encoded using a dictionary of 2048 words. This system is used by OpenBSD for secure login and can be used as a SASL mechanism for authenticating users. In this implementation we provide support for four algorithms that are included in the tcllib distribution: MD5 (2), MD4 (3), RIPE-MD160 (4) and SHA-1 (5). COMMANDS
::otp::otp-md4 ?-hex? ?-words? -seed seed -count count data ::otp::otp-md5 ?-hex? ?-words? -seed seed -count count data ::otp::otp-sha1 ?-hex? ?-words? -seed seed -count count data ::otp::otp-rmd160 ?-hex? ?-words? -seed seed -count count data EXAMPLES
% otp::otp-md5 -count 99 -seed host67821 "My Secret Pass Phrase" (binary gibberish) % otp::otp-md5 -words -count 99 -seed host67821 "My Secret Pass Phrase" SOON ARAB BURG LIMB FILE WAD % otp::otp-md5 -hex -count 99 -seed host67821 "My Secret Pass Phrase" e249b58257c80087 REFERENCES
[1] Haller, N. et al., "A One-Time Password System", RFC 2289, February 1998. http://www.rfc-editor.org/rfc/rfc2289.txt [2] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT and RSA Data Security, Inc, April 1992. (http://www.rfc-edi- tor.org/rfc/rfc1321.txt) [3] Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT, April 1992. (http://www.rfc-editor.org/rfc/rfc1320.txt) [4] H. Dobbertin, A. Bosselaers, B. Preneel, "RIPEMD-160, a strengthened version of RIPEMD" http://www.esat.kuleuven.ac.be/~cosi- cart/pdf/AB-9601/AB-9601.pdf [5] "Secure Hash Standard", National Institute of Standards and Technology, U.S. Department Of Commerce, April 1995. (http://www.itl.nist.gov/fipspubs/fip180-1.htm) BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category otp of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. SEE ALSO
SASL, md4, md5, ripemd160, sha1 KEYWORDS
hashing, message-digest, password, rfc 2289, security COPYRIGHT
Copyright (c) 2006, Pat Thoyts <patthoyts@users.sourceforge.net> otp 1.0.0 otp(n)