04-02-2012
open the file using the open method and read the data using while loop and check how many lines having the pattern. And in the end, you are write the count in the original file.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi ,
I am using SUN OS Version 5.6.
I have a file that contains records of length 270. when I do 'set nu' in vi editor, I get the count as 86. whereas when I do "wc -l" on the command prompt, it shows the count as only 85. this is very strange. why would the 'wc' show 1 record less. The job... (3 Replies)
Discussion started by: tselvanin
3 Replies
2. Shell Programming and Scripting
Hi,
I have a file .. file.txt .. i need to get a total record count in the files into a $variable.. im using perl script
thanks (4 Replies)
Discussion started by: meghana
4 Replies
3. UNIX for Dummies Questions & Answers
Hi Guys,
I want to write a perl/shell script do parse the following file
input file content
NPA-NXX SC
2084549 45
2084552 45
2084563 2007
2084572 45
2084580 45
3278411 45
3278430 45
3278493 530
3278507 530... (3 Replies)
Discussion started by: pistachio
3 Replies
4. Shell Programming and Scripting
Hi all, I am trying to write a command that can help me count the number of lines in the /etc/passwd file ending in bash.
I have read through other threads but am yet to find one indicating how to locate a specifc word at the end of a line. I know i will need to use the wc command but when i... (8 Replies)
Discussion started by: warlock129
8 Replies
5. Shell Programming and Scripting
Hi friends, I am working on a perl script to count the commented lines, blank lines and source lines separately. Let me know if you have one. For example i have a file containing the lines:
/**
* SOURCE CODE
*/
public class SessionConstants {
/**
* Code for Session created
*/... (4 Replies)
Discussion started by: nmattam
4 Replies
6. Shell Programming and Scripting
how to count the total number of lines of all the files under a directory using perl script..
I mean if I have 10 files under a directory then I want to count the total number of lines of all the 10 files contain. Please help me in writing a perl script on this. (5 Replies)
Discussion started by: adityam
5 Replies
7. Programming
Hi,
from the manual
listen(2): listen for connections on socket - Linux man page
It has a parameter called backlog and it limits the maximum length of queue of pending list.
If I set backlog to 128, is it means no more than 128 packets can be handled by server?
If I have three... (3 Replies)
Discussion started by: sehang
3 Replies
8. Shell Programming and Scripting
Hi,
I am having .csv files contains some row -
Info: Value of field name 'SecurityExchange' is not supported ","Original Order Tuple
Please see the below perl code carefully-
/Info: (+),Original (\w+) Tuple/ and do {
($category, $type) = ($1, $2);
if($type eq 'Execution')... (1 Reply)
Discussion started by: pspriyanka
1 Replies
9. Shell Programming and Scripting
can i get a simple script for , Count same word which has come many times in single lines & pars
Eg file would be ==
"Thanks heman thanks thanks
Thanks heman
thanks man"
So resullt should be
Thanks = 5
heman=2
man = 1
thanks in advance :)
Please use code tags for code and... (1 Reply)
Discussion started by: heman96
1 Replies
10. UNIX for Beginners Questions & Answers
I am trying to figure out to find word count of each word from my file
sample file
hi how are you
hi are you ok
sample out put
hi 1
how 1
are 1
you 1
hi 1
are 1
you 1
ok 1
wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies
LEARN ABOUT DEBIAN
control.ctl
CONTROL.CTL(5) File Formats Manual CONTROL.CTL(5)
NAME
control.ctl - specify handling of Usenet control messages
DESCRIPTION
The file /etc/news/control.ctl is used to determine what action is taken when a control message is received. It is read by the parsecon-
trol script, which is called by all the control scripts. (For an explanation of how the control scripts are invoked, see innd(8).)
The file consists of a series of lines; blank lines and lines beginning with a number sign (``#'') are ignored. All other lines consist of
four fields separated by a colon:
message:from:newsgroups:action
The first field is the name of the message for which this line is valid. It should be either the name of the control message, or the word
``all'' to mean that it is valid for all messages.
The second field is a shell-style pattern that matches the email address of the person posting the message. (The poster's address is first
converted to lowercase.) The matching is done using the shell's case statement; see sh (1) for details.
If the control message is ``newgroup'' or ``rmgroup'' then the third field specifies the shell-style pattern that must match the group
being created or removed. If the control message is of a different type, then this field is ignored.
The fourth field specifies what action to take if this line is selected for the message. The following actions are understood:
doit The action requested by the control message should be performed. In most cases the control script will also send mail to usenet.
doifarg
If the control message has an argument, this is treated as a ``doit'' action. If no argument was given, it is treated as a ``mail''
entry. This is used in ``sendsys'' entries script so that a site can request its own newsfeeds(5) entry by posting a ``sendsys
mysite'' article. On the other hand, sendsys ``bombs'' ask that the entire newsfeeds file be sent to a forged reply-to address; by
using ``doifarg'' such messages will not be processed automatically.
doit=file
The action is performed, but a log entry is written to the specified log file, file. If file is the word ``mail'' then the record
is mailed. A null string is equivalent to /dev/null. A pathname that starts with a slash is taken as the absolute filename to use
as the log. All other pathnames are written to /var/log/news/file.log. The log is written by writelog (see newslog(8)).
drop No action is taken; the message is ignored.
log A one-line log notice is sent to standard error. Innd normally directs this to the file /var/log/news/errlog.
log=file
A log entry is written to the specified log file, file, which is interpreted as described above.
mail A mail message is sent to the news administrator.
Lines are matched in order; the last match found in the file is the one that is used. For example, with the following three lines:
newgroup:*:*:drop
newgroup:tale@*.uu.net:comp.*|misc.*|news.*|rec.*|sci.*|soc.*|talk.*:doit
newgroup:kre@munnari.oz.au:aus.*:mail
A newgroup coming from ``tale'' at a UUNET machine will be honored if it is in the mainstream Usenet hierarchy. If ``kre'' posts a new-
group message creating ``aus.foo'', then mail will be sent. All other newgroup messages are ignored.
HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is revision 1.8, dated 1996/09/06.
SEE ALSO
innd(8), newsfeeds(5), scanlogs(8).
CONTROL.CTL(5)