Sponsored Content
Full Discussion: counting number of sentence
Top Forums Shell Programming and Scripting counting number of sentence Post 302354433 by siba.s.nayak on Friday 18th of September 2009 05:54:27 AM
Old 09-18-2009
Code:
 find . -type f -exec cat {} \; | tr '.' "\n" | grep -v "^$" | wc -l

The abobe command will give you total number of sentences in all the files in that directory.

Code:
for file in `find . -type f`
do
echo -n $file
cat $file | tr '.' "\n" | grep -v "^$" | wc -l
done

Above script will give the numbers of sentences in each file.
 

10 More Discussions You Might Find Interesting

1. Linux

counting the number of lines

Hello, I have afile which begins with a few urls on multiple lines and then there is listing of some information on separate lines. The listing begins with the word Name on a given line followed by teh actual list. I want to count the number of lines in this file after the line having... (6 Replies)
Discussion started by: nayeemmz
6 Replies

2. UNIX for Dummies Questions & Answers

Counting number of occurences

Hi All, I have to count the number of occurences of the character " ; " in a given line. I had used the following awk command to achieve the same echo $KOP.dat|awk '{split($1,my,";"); for(i in my)c++ }END{print c-1}' My file KOP.dat had the following data ... (1 Reply)
Discussion started by: kingofprussia
1 Replies

3. Shell Programming and Scripting

Counting the number of pipes in line

Hi, I'm using the ksh shell. The scenario: I have a couple of directories /home/fd /home/fd/prsd home/fd/stg now i have number of files in each of these directories. some of the files are zipped using gzip so their extension is .gz the content of the files is as follows ... (4 Replies)
Discussion started by: nirnay_s
4 Replies

4. Shell Programming and Scripting

counting the number of lines - again

Hi all, I use bash shell and I have a problem with wc. I would like to determine the number of lines in a file so I do wc -l filename but I don't want to get the filename again I just would like to have the number of lines and use it in a variable. Can anybody help? Thank you, (7 Replies)
Discussion started by: f_o_555
7 Replies

5. Shell Programming and Scripting

counting the number of occurences

say i've got a text file with >10million sequences: ssss ssss tttttt uuuuuu uuuuuu uuuuuu ... I'd like to convert the file so that the output will report the number of occurence right by each sequence: 2 ssss 2 ssss 1 tttttt 3 uuuuuu 3 uuuuuu 3 uuuuuu .... (3 Replies)
Discussion started by: johjoh
3 Replies

6. UNIX for Dummies Questions & Answers

Script to ask for a sentence and then count number of spaces in the sentence

Hi People, I need some Help to write a unix script that asks for a sentence to be typed out then with the sentence. Counts the number of spaces within the sentence and then echo's out "The Number Of Spaces In The Sentence is 4" as a example Thanks Danielle (12 Replies)
Discussion started by: charlie101208
12 Replies

7. Shell Programming and Scripting

Counting the number of characters

Hi all, Can someone help me in getting the following o/p I/p:... (7 Replies)
Discussion started by: Sri3001
7 Replies

8. Shell Programming and Scripting

How to get a number from a grepped sentence of a file?

I want get a number(ID) from a sentence which has been grepped from file using error number. For Example: #!/bin/ksh echo "Enter RRS ID: " read rrs echo "Enter error number:" read err scp -pr ptc-avdbamdw102:/home/icsprd/M3logs/Accurate/logs/corp_post/$rrs.*.err.txt $HOME/daemon_mail/... (7 Replies)
Discussion started by: JayDoshi
7 Replies

9. Shell Programming and Scripting

How to receive a specific alphanumeric number from a sentence?

Hi, I am quite new to shell scripting. I am facing challenge in retrieving a specific number from a sentence from the log. the number is random and changes everytime in the log. For example, The number of rows updated in table is: 7000 The number of rows updated in table is: 8000 The... (3 Replies)
Discussion started by: arghadeep adity
3 Replies

10. Shell Programming and Scripting

Help: Counting values less than a number

So I have several files (35000, to be exact) in the format rmsd_protein_*.dat each with 2 columns and 35000 rows. I would like to count how many values in the second column are less than 3 for each file, and output it into a new file so that it ultimately appears as: 1 14057 2 ... (12 Replies)
Discussion started by: Alexandryne
12 Replies
GPSPIPE(1)							GPSD Documentation							GPSPIPE(1)

NAME
gpspipe - tool to connect to gpsd and retrieve sentences SYNOPSIS
gpspipe [-h] [-d] [-l] [-o filename] [-n count] [-r] [-R] [-s serial-device] [-t] [-T timestamp-format] [-p] [-w] [-v] [-D debug-level] [server [:port [:device]]] DESCRIPTION
gpspipe is a tool to connect to gpsd and output the received sentences to stdout. This makes the program useful as a pipe from gpsd to another program or file. gpspipe does not require root privileges, and can be run concurrently with other tools connecting to the local gpsd without causing problems. The output will consist of one or both of the raw NMEA or native gpsd sentences. Each line can be optionally time stamped. There is also an option to exit gracefully after a given count of packets. Optionally a server, TCP/IP port number and remote device can be given. If omitted, gpspipe connects to localhost on the default port (2947) and watches all devices opened by gpsd. gpspipe may be run as a daemon, but requires the -o flag for writing the output to a file. OPTIONS
-h makes gpspipe print a usage message and exit. -d causes gpspipe to run as a daemon. -l causes gpspipe to sleep for ten seconds before attempting to connect to gpsd. This is very useful when running as a daemon, giving gpsd time to start before attempting a connection. -r causes raw NMEA sentences to be output. -R causes super-raw (gps binary) data to be output. This overrides NMEA and gpsd output modes. -s option causes the collected data to be written to the specified serial device with settings 4800 8N1. Thus gpspipe can be used with -s and -r options to emulate a serial port hardwired to a GPS that gpsd is managing. -o option causes the collected data to be written to the specified file. Use of this option is mandatory if gpspipe is run as a daemon. -w causes native gpsdsentences to be output. -t adds a timestamp to each sentence output. -T sets the format of the timestamp. See strftime(3) for the available placeholders. Setting this option implies -t. -p enables dumping of profiling information in JSON. -n [count] causes [count] sentences to be output. gpspipe will then exit gracefully. -v causes gpspipe to show a spinning activity indicator on stderr. This is useful if stdout is redirected into a file or a pipe. By default the spinner is advanced with every messages written; specifying -v more than once will double the number of messages required to rotate the spinner. -V prints the version, then exits. At least one of -R, -r or -w must be specified. EXAMPLE
When gpsd is running gpspipe -r -n 100 will send one hundred raw NMEA sentences to standard output, then exit. SEE ALSO
gpsd(8), gps(1), libgps(3), libgpsd(3), gpsprof(1), gpsfake(1), gpsctl(1), gpscat(1). gpsmon(1). AUTHOR
Gary E. Miller gem@rellim.com. The GPSD Project 03 Aug 2005 GPSPIPE(1)
All times are GMT -4. The time now is 08:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy